1 mamuf Feb 19, 2005 21:33
3 kiesow Feb 20, 2005 02:27
many people complainted as b2evo switched to objects and they had to rework their skins because they haven't worked any longer.
and AFAIK it has been said that this major change for skins will be the only one for a long time.
beside that the dev-team is very small and busy (at the moment), so i don't think that there be any efforts on a real template engine.
4 mamuf Feb 20, 2005 10:00
I thought that. Okay, this is a small tax for all the features b2evo offers :). There are many other weaknesses that are more important :).
5 marston Feb 20, 2005 17:38
:roll:
6 powersusa Feb 24, 2005 14:49
As a proof of concept I integrated [url=http://xitemplate.sourceforge.net/] XiTemplate[/url] into b2Evo. For this test I created a very simple theme/skin which only outputs simple posts (the intent was to prove it could be done).
The nice thing about XiTemplate is that the templates do not have any "template logic" like if, switch, foreach, while etc. Instead the templates define nestable blocks denoted by XiTemplate specific html comments. Since the blocks are defined with html comments they are easy to work with in your favorite WYSIWYG html editor. Blocks are passive and will not generate any output in the final markup unless they are explicitly parsed. So you could define blocks that are intended to be conditionally parsed (think "if"). Blocks can also be parsed multiple times (think "loop" for posts and other repeated content). Within the blocks are variable markers which specify the name and location (within the final markup) of dynamic content (everything which now shows ups as a php function call in a typical b2Evo skin).
The loading of template files, assignment of values to variable markers and the parsing of blocks occurs in a php script naturally. This script is a "controller" for your template. For my test the controller was _main.php. So my _main.php was a pure php script with zero html code. I am now free to change my template without having to touch _main.php. I can also change _main.php, to use a different object model for example, without needing to change any of my templates.
For this to provide a full blown template system for b2Evo you would need to define a set of known template file names, block names and variable marker names for those blocks. Theses are the "language" of the template and would be used by everyone. Then you would write a generic controller (or controllers) that would be the same for each theme/skin.
Note you would not be able to edit your template in the admin interface without further hacks.
Note that the version of XiTemplate that I used was modified by me to work with php4. My version also supports the concept of block specific variables and global variables (in standard XiTemplate all variables are global). My version also allows for missing blocks so you do not need to include every block in your template that the controller tries to parse (think optional content). Currently XiTemplate variable markers are defined in templates as {marker_name}. I'm working on allowing the marker names to be defined by special html "span" tags which would work well with html editors and allow you to include sample text (good for working out the layout) in your template that will be purged by the template engine.
I plan to work on this some more over the coming weeks...
So, basically, you're asking them to make it so there are macros, like so?
Kinda like how blogger.com's template engine works?
Sorry pal, I don't think they'll change it just for you, and if there is a hack to make the template engine, it'll be a huge ass one. So huge, that...
Well, It'll just be huge okay? :)