Template layers
Does Elk still use template_layers to allow adding say site_above and site_below for integration with non-forum content?
Re: Template layers
Reply #5 –
I wouldn't call it a subset because I have no idea WTF Wedge's template system looks like.
Re: Template layers
Reply #7 –
You can define the template as a tree. You don't need _before/_after(). Actually, it wouldn't even be a tree. A tree can go off in multiple ways at the same time. Neither yours nor Elkarte's or SMF's can branch off in two ways. It needs to have 1 path that goes forwards and backwards. They are stacks.
Yeah, my changes implement pretty much the exact same thing as yours but it doesn't have an XML file from the beginning. You just work with the templates with events.
Re: Template layers
Reply #8 –
But then you have to work within the constraints of templates. You can't move a block of HTML around without resorting to js or a copy of the template. Meaning mods can't do it without modifying the php files themselves... :-/
Re: Template layers
Reply #10 –
I'm afraid I don't really see how this is superior or even on par with my skeleton system in terms of flexibility.
I hope for elk that it is, though. It would be a shame if modders dropped it for that even though it has plenty of goodies for them. The reason I wrote the skeleton system was because I needed it. Maybe I'm too demanding or lazy as a modder. I dunno.
Re: Template layers
Reply #11 –
I don't know anything about your system so I can't compare.
I don't understand how you can't see that by using $theme->template_call('template_name', $parameters); and registering an event listener for 'template_name__exec' gives you the maximum amount of flexibility because you essentially control every template call there is. You can completely change the entire theme by only using events. The event system contains priorities so you can even prioritize which templates are called first.
Oh well, that's why there are a multitude of forks. So people can go off and do things differently.
Re: Template layers
Reply #12 –
I guess it's not a bad idea to allow for hooks to cancel the execution of the 'default' template, but usually that'd be because you want to replace it with something else, in which case 'override' is all you want. And template_call() doesn't seem to account for the possibility of wanting to override an override. Maybe it's a silly idea, but I've accounted for it because, again, I needed it at some point. (Although I changed my mind after that, but had no reason to remove that.)
Re: Template layers
Reply #13 –
In a future version it will use the event system that I showed elsewhere. That allows for priorities and propagation stop which allows you to do all of that with ease. You can always override an override though. More difficult, but still possible. I wouldn't advise it just because you don't know the outcome, but I can think of two ways: use output buffering to capture the output and throw it away or have your event listener (hook) remove the other listeners on that event.