devbanana Posted August 26, 2006 Share Posted August 26, 2006 What, in your opinion, would the perfect templating system be like? I'm not looking for systems that have been already made, but features that you would want to see in a good templating system. Please be realistic. :)I know some people just like to have PHP intermingled with HTML, such as:[code]Hello <?php echo $user?>.[/code]But I don't really like this. It would be too tempting to do some processing in the presentation layer that does not belong in the presentation layer, plus I think it is too messy, as far as syntax is concerned.I'm thinking of, perhaps, a declarative syntax, that would mostly look like regular HTML, but would be parsed by the template system and replaced. Quote Link to comment https://forums.phpfreaks.com/topic/18712-perfect-templating-system/ Share on other sites More sharing options...
devbanana Posted August 27, 2006 Author Share Posted August 27, 2006 Great to see this is generating such an enthusiastic response. ::)Well, in spite the fear of talking to myself...I have been checking out XSLT, and it seems like it'd be a very nice tool to use for templating. A bit complicated, but at least it is a standard, and it can output various formats, so it doesn't necessarily need to be bound to outputting HTML/XHTML. Quote Link to comment https://forums.phpfreaks.com/topic/18712-perfect-templating-system/#findComment-81216 Share on other sites More sharing options...
steelmanronald06 Posted August 28, 2006 Share Posted August 28, 2006 SMARTY Quote Link to comment https://forums.phpfreaks.com/topic/18712-perfect-templating-system/#findComment-81571 Share on other sites More sharing options...
devbanana Posted August 28, 2006 Author Share Posted August 28, 2006 [quote author=steelmanronald06 link=topic=105698.msg423288#msg423288 date=1156768849]SMARTY[/quote]Hi,Thanks for the reply. However, as I mentioned in my first post, I'm not looking for existing templating systems, but what features you would look for in a templating system.I don't like Smarty, because the logic is too imparative. If you're going to use Smarty, you may as well just use PHP for presentation logic, because they're both just as imparative. Quote Link to comment https://forums.phpfreaks.com/topic/18712-perfect-templating-system/#findComment-81576 Share on other sites More sharing options...
steelmanronald06 Posted August 28, 2006 Share Posted August 28, 2006 Honestly, I can't really say. I create my own template systems for each project I do. That way I have a system that is unique and custom to each project. Quote Link to comment https://forums.phpfreaks.com/topic/18712-perfect-templating-system/#findComment-81695 Share on other sites More sharing options...
redbullmarky Posted September 1, 2006 Share Posted September 1, 2006 off the back of this article:http://www.massassi.com/php/articles/template_engines/i created my own. the problem with templating engines is, whilst they offer plenty of other features, they're just ultimately a new set of syntax. people take the "seperation" a bit too far, when the actual idea is just to seperate your "business" logic from your "presentation" logic. no matter how hard you try, its not really possible to remove ALL of your code from the HTML - no matter how you dress it up, re-syntax it, etc.ok, so some people don't like using php short tags. but if they do, is typing <?=$name; ?> really that much harder than {name} ? and many of these 'Engine' templates also use similar methods for looping, whereas the 'foreach' in PHP is simple enough in itself, without the need to replace it with a new set of syntax.in terms of what i look for - just something lightweight and simple that keeps the bus/pres logic as seperate as possible. i literally have 3 main functions in my template class other than the constructor:1. function to set a variable2. function to load a (sub)template to a variable3. function to outputseriously, the link i posted above is definitely an excellent read which, in itself, covers most of your queries.hope that helps a bitCheersMark Quote Link to comment https://forums.phpfreaks.com/topic/18712-perfect-templating-system/#findComment-84053 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.