Technically speaking, an if() test is always going to be so fast, that any alternative would be a waste of time. I was wary of doing mini-skeletons, precisely because of the growing number of tests and function calls, but in the end, it was really nothing to be scared of. The entire rendering of topic mini-skeletons added something like, a millisecond or two to the overall execution time... So, really, splitting the current Msg mini-skeleton into ten times more functions wouldn't kill performance either, after all the most time spent when rendering a page is on the client side, not server side. Always has been... Always will be.
I can't see many alternatives either, anyway.
- Removing skeleton entries at Sources time: implies calling wetem::remove or weSkeleton->remove, it's not particularly much faster... And not as flexible, either.
- Adding the tests directly into the skeleton tree: I guess we could do it in several possible ways...
<if member>
<this_skeleton />
</if>
or
<member@this_skeleton />
or
<SKIN_MOBILE@this_skeleton />
or
<mobile@this_skeleton />
or
<SKIN_SIDEBAR==left@this_skeleton />
or
<this_skeleton:params:SKIN_MOBILE />
<this_skeleton::SKIN_mobile />
<this_skeleton:params@SKIN_MOBILE />
or
<this_skeleton:SKIN_MOBILE:params />
<this_skeleton::params />
<this_skeleton@SKIN_MOBILE:params />
None of these really strike me as 'nice-looking', except possibly the last one (we don't use params THAT much... Only in linktrees, I think, for now.)
I'm absolutely willing to implement one of these, of course, if it gives themers and plugin authors even more flexibility. And we all hate doing tests at the beginning of each function, of course... I just don't know which way to go.
Of course, '@' is a temp separator I came up with to say, "this template block is intended for (directed @) members", etc. It probably isn't XML-compatible, but as everyone probably knows, the skeleton isn't parsed by a XML library, it's only written that way to help with readability. (Heck, I could very well switch to a JSON-like structure, and then actually parse it with json_decode()... Hmm, idea to explore...??!!)