Welcome Guest, Not a member yet? Register   Sign In
template engine: twig, dwoo, smarty or CI parser?
#5

[eluser]John Nickell[/eluser]
I've been working on a pure PHP template library, since I have been unable to find an OO template class that includes template inheritance.

I've tried Smarty and Twig, and I like both of them, but I was hoping for "lighter" solution. My ideal class would allow:

1. Partial and nested views
2. Overriding default templates with more-specific templates
3. Template inheritance (more-specific template can extend the default)

The "pure" PHP solutions out there either don't offer template inheritance, or use global variables instead of class variables for the stored data.

Is there anyone else that is looking for a similar solution, that has maybe found it?

If anyone is interested, I might create a GitHub repository with the one I'm working on, but I am an admittedly inexperienced coder.

So far it has a syntax that looks like this:

<?php $this->extend(‘default.tpl.php&rsquoWink; ?>

<?php $this->block(‘content&rsquoWink; ?>
<p>extended content that replaces base template block</p>
<?php $this->endblock(); ?>

<?php $this->endextend(); ?>

Of course, if you wanted to replace the entire default template, you would just follow some naming convention to create the more-specific template...then do not extend the base template. So you can replace the entire template, or blocks, and you do that on a full-view or partial-view level.


Messages In This Thread
template engine: twig, dwoo, smarty or CI parser? - by El Forum - 03-14-2011, 11:25 AM
template engine: twig, dwoo, smarty or CI parser? - by El Forum - 03-15-2011, 05:52 PM
template engine: twig, dwoo, smarty or CI parser? - by El Forum - 03-15-2011, 07:48 PM
template engine: twig, dwoo, smarty or CI parser? - by El Forum - 03-16-2011, 10:09 AM
template engine: twig, dwoo, smarty or CI parser? - by El Forum - 02-16-2012, 02:48 PM
template engine: twig, dwoo, smarty or CI parser? - by El Forum - 02-16-2012, 04:07 PM
template engine: twig, dwoo, smarty or CI parser? - by El Forum - 02-23-2012, 04:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB