joshman13 Posted February 28, 2006 Share Posted February 28, 2006 hello everyone,i am looking at building a lightweight template engine for some of myscripts that i am using. i have looked into several different ones, andalthough many have great features, none have exactly what i am lookingfor. the main thing i haven't liked is that most of them use{placeholder} style tags, which creates unnecessary overhead, becausephp itself is a template language, so why create a wrapper forsomething that already does the job?for most of the pure php template classes, this is what i've seen forthe most part:: assign variables that replace content: start an output buffer: include the template file: store the rendered content of the template file in a varable: clear the output buffer: return the rendered contenti really like this format just because it allows sub-templates in amain file. for instance, i can have a template file for the completeshell, but then have another file to include everytime i want a table,or a menu, or anything modular like that.i was thinking about this though, and basically the entire page isstored in a variable before the output is ever sent to the screen. arethere any drawbacks to doing it this way? what about speed and memory?are there better ways to go about it? Link to comment https://forums.phpfreaks.com/topic/3751-php-template-engine/ Share on other sites More sharing options...
ttocskcaj Posted April 1, 2011 Share Posted April 1, 2011 Template engines such as smarty cache the pages as pure html. So the page is only drawn the first time, or if it changes. Link to comment https://forums.phpfreaks.com/topic/3751-php-template-engine/#findComment-1195362 Share on other sites More sharing options...
vbnullchar Posted April 1, 2011 Share Posted April 1, 2011 try mustache for PHPhttps://github.com/bobthecow/mustache.php Link to comment https://forums.phpfreaks.com/topic/3751-php-template-engine/#findComment-1195397 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.