deadfrog Posted April 18, 2007 Share Posted April 18, 2007 Hi chaps - I've just made the jump from ASP to PHP and am already wondering why I didn't do it sooner. Anyway, one of my learning techniques has been to download and check through things like phpBB and other such things, and I notice they declare constants almost, using a {SITE_NAME} style syntax. I'm keen to learn more about this technique and am happy to hunt the information down on the internet, but I just don't know what it's called so not sure what to search for... Any pointers would be hugely appreciated, I only just found this site and it looks grand! Best regards, Andy. Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted April 18, 2007 Share Posted April 18, 2007 PHPBB uses a template engine of its own, which essentially means that all of the main forum code is kept seperate from the files that are essentially the HTML. If you look in a template directory at some of the files, you probably wont see any php at all. The {SITE_NAME} example just means that where the variable $site_name (or something like that) has been set, replace all instances of {SITE_NAME} with the contents of the variable. The idea is that it allows designers to create templates/skins without breaking the actual code, and is allegedly less intimidating to use {SITE_NAME} rather than <?=$site_name ?> or <?php echo $site_name ?> Smarty is a template engine that uses these types of tokens, if you wish to go down that road. Personally I chose the method laid out here: http://www.massassi.com/php/articles/template_engines/ which essentially does the same thing - ie, seperates business logic from presentation logic, but not forgetting that you dont need an entire new syntax to do it... The short answer to your question: Templating/Template Engines. Hope it helps! Cheers Quote Link to comment Share on other sites More sharing options...
deadfrog Posted April 18, 2007 Author Share Posted April 18, 2007 Ahha, template engines look like exactly what I was talking about, thanks muchly mate, and for the record peas are ace. Andy. Quote Link to comment 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.