View Single Post
  #6 (permalink)  
Old 02-27-2006, 10:42 PM
Easywebdev's Avatar
Easywebdev Easywebdev is offline
WebProWorld Veteran
 

Join Date: Apr 2004
Location: Donegal, Ireland.
Posts: 328
Easywebdev RepRank 1
Default

Billy, most template sytems I have looked at are terribly bloated, their failing is that they try to much. They may suit some people and not others. Smarty even lets you have php within your tpl file and that in my opinion defeats the purpose of a templating engine. Ideally you should have one php file that does ALL the php work before outputting anything to the browser, whether that is database interaction or just re-using common data with the use of {VARIABLE} tags.
The php include function should only include php files, never html content, that should be left to the templating engine to parse.

You are using one of the greatest templating engines out there at the moment. Phpbb, if you have never used it then please download it and look at how the template engine works in tandem with a database abstraction layer and all calculations/variable assignments are done before outputting the html.

Mike. I can't exactly remember when I converted to php (probably around 7 years ago) but I was using the same methodology of re-using code (ie, header, footer, common menu etc) via the use of SSI (server side includes).

I've put up a small five page site at www.easywebdev.com/basic_site/ username and password=webproworld where you can view source for each page and see how the page titles, meta tags etc change even though there is only one header file. You can download the package from the index page. You will then be able to take a look at the code to get a better understanding of what I said in my first reply. The template engine is only three functions (about 20 lines of code) but all it needs to do is parse {VARIABLES} within the tpl files.

Take a look at the site and code and feel free to pm me or post again here in case others use it and have questions.

As for speeding up development, yep, once you get used to re-using specific parts of your site such as the header/menu/footer then adding a new page is a 10 second cut/paste job, then add your page specific content file.
Reply With Quote