GuitarGod Posted March 6, 2009 Share Posted March 6, 2009 Hi all, I was just wondering if anyone knew of any good tutorials on creating your own template engine? Mostly just to seperate PHP from HTML, also to use for blocks: if ( CONDITION ) { $template->block( NAME ) // you get the picture } I know there are lots of free template engines out there I could use, but for this project I really think I should create my own, nothing too fancy, just to do the basics. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/148294-any-tutorials-of-template-engines/ Share on other sites More sharing options...
trq Posted March 6, 2009 Share Posted March 6, 2009 See my post here to see why I think template engines are a waste of resources. Quote Link to comment https://forums.phpfreaks.com/topic/148294-any-tutorials-of-template-engines/#findComment-778551 Share on other sites More sharing options...
pcw Posted March 6, 2009 Share Posted March 6, 2009 www.smarty.net supplies all the documentation you need, and its very simple Quote Link to comment https://forums.phpfreaks.com/topic/148294-any-tutorials-of-template-engines/#findComment-778575 Share on other sites More sharing options...
Daniel0 Posted March 6, 2009 Share Posted March 6, 2009 I agree with thorpe. I think template engines are overkill and do not add any value to the development work flow. Quote Link to comment https://forums.phpfreaks.com/topic/148294-any-tutorials-of-template-engines/#findComment-778591 Share on other sites More sharing options...
GuitarGod Posted March 7, 2009 Author Share Posted March 7, 2009 I can see your point and have often thought about mixing the basic HTML with PHP, but this is a commercial project so I thought it best to have the code as "professional" as possible, and people tend to frown upcode mixed PHP/HTML. But your method is definitley worth consideration, thanks Quote Link to comment https://forums.phpfreaks.com/topic/148294-any-tutorials-of-template-engines/#findComment-779007 Share on other sites More sharing options...
Daniel0 Posted March 7, 2009 Share Posted March 7, 2009 I think you've misunderstood the mixed PHP/HTML thing. Mixed PHP/HTML thing is no problem, but mixed presentational and business logic is. Quote Link to comment https://forums.phpfreaks.com/topic/148294-any-tutorials-of-template-engines/#findComment-779014 Share on other sites More sharing options...
xylex Posted March 9, 2009 Share Posted March 9, 2009 Templating is really just DOM element iteration and tag replacement. If you make a DOM based templating system that mimics the behavior of a library like jquery, you minimize the need for frontend guys to learn a new syntax. I'd recommend reading up on the DOM libraries, specifically DOM and SimpleXML, and go with a DOM based templating engine. I know this isn't the most processor efficient code, but in terms of project maintainability, it's a heck of a lot easier to find a good XHTML/JS coder than a good XHTML/JS/PHP coder. Quote Link to comment https://forums.phpfreaks.com/topic/148294-any-tutorials-of-template-engines/#findComment-780652 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.