i got an idea for making php template engine fast and user friendly but i’m not sure if it’s good or bad.
the idea is to create a fake template engine:
creating a template editor in control panel that let user see something like this:
<html>
<head>
<title>{title}</title>
</head>
<body> {content} </body>
</html>
what the editor actually does is to replace all php code like
<?php echo $this->title; ?>
to user friendly
{title}
but it’s not really replacing it just in the view when the user save the template
the template actually saved as fast pure php template.
the question is this a good idea or bad ?
your answers is highly appreciated.
That’s the notion in a number of different template libraries. Namely that some watered-down notation such as
{varname}(compared to<?=$varname?>) for people more familiar with html & css, and little to no knowledge of php will have an easier time understanding.Of course lots of these systems also support a notation for looping and conditionals which to me begs the question, how much difference is it really making? It’s not uncommon to see these systems support some type of attributes or parameters in the given ‘tags’. There are so many libraries which embrace this idea of a simplified notation, obviously there are folks that think a non-php syntax is easier to understand.
This comes with the tradeoff of having to invent your own notation for such things as loop control notation, conditionals etc, if you want to support them. If your system provides mere variable substitution and it’s for customizing emails for example, could be a really good idea. If on the other hand you’re starting out with this level of knowledge trying to re-invent something like smarty, I’d recommend taking a peak at one or several of the existing template libraries before getting deep into your own system, and not just from the end user’s perspective, but at the implementation (the php code) of the libraries too.
Maybe you just end up building a cool GUI around smarty or some other template library?