Le samedi 07 octobre 2006 à 17:24 -0400, sit1way a écrit : > Hey all. Hi Noah, > I've built a simple, yet effective PHP based CMS, one that I use in all > sites I develop. [...] > I've often heard the mantra, "separate code from HTML", but it seems > ridiculous at times to include tiny HTML snippets that can easily be echoed > out, or stored in a variable. That mantra generally helps not getting your code and your graphics messed up. It is only a good suggestion, so you do whatever you want with it. It's like object oriented programming... it's a good suggestion and it proves very useful most of the time, but it's for you to judge if it is useful in your case, and most of the time you cannot judge perfectly without trying it. > Smarty goes to the extreme in separating code > from HTML, but looking at their templating system, I wonder what's the > point? Is it the end of the world if you've got a few choice if, then, else > statements in your HTML templates? Smarty goes to the extreme because it is *just* a templating engine. You can still use PHP code in Smarty templates by using specific tags, but for trying it I think it makes sense to prepare everything *outside* the display script. The display script can then be given to work on to a web designer without him messing everything up. It also helps not getting into one display script that will handle 5 different types of display depending on the conditions. One display script should really display one kind of data in a specific format. If you want to change the format, it makes sense to change the display script. > I'm thinking of creating a bunch of include files based on request type in > my CMS Admin Center; e.g. include "classes/admin/news/add.php", where add, > update, or delete is the request type. This cleans up my PHP processing > pages quite a bit (don't have all the if add, do X, elseif update, do Y, > etc. logic to comb through). You can also use the same code base (by playing with Apache VirtualHost's) and only change the config file and templates location, rather than the opposite. Up to you again. Yannick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php