Jump to content

[SOLVED] Potential noob question...


deadfrog

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.