CMS and templates

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • webcm123@gmail.com

    CMS and templates

    I think how to attach document body to the template. The previous
    method don't allow to change <title>, add headers or code to <head>.
    However, it has some advantages - modules don't care about including
    template or defining FILE constant.

    http://nopaste.php-quake.net/236 - there are the methods
    with advantages and disadvantages

    What should I choose? I want a good fast method. The performance is
    important. Can you give me some advices? :)

  • Mike P2

    #2
    Re: CMS and templates

    On May 5, 9:27 am, webcm...@gmail. com wrote:
    I think how to attach document body to the template. The previous
    method don't allow to change <title>, add headers or code to <head>.
    However, it has some advantages - modules don't care about including
    template or defining FILE constant.
    >
    http://nopaste.php-quake.net/236 - there are the methods
    with advantages and disadvantages
    >
    What should I choose? I want a good fast method. The performance is
    important. Can you give me some advices? :)
    For quick solutions, I have a directory for all templates, and within
    that directory another directory for every layout. Within each layout
    directory, I would have several files, something like this:

    -/layouts/layout1/head.tpl: <!doctype...><h tml><!--common head stuff--!
    >
    -/layouts/layout1/header.tpl: </head><body><!--page header-->
    -/layouts/layout1/footer.tpl: <!--page footer--></body></html>

    Sometimes I don't include </head><bodyin heade.tpl, it shouldn't
    matter much. Then I either set $template = 'layout1' in a common.php
    file and include( "/layouts/$template/whatever.tpl" ) wherever it
    should go on the page. Sometimes I just readfile() them in if there is
    no PHP code in the .tpl files, which should be more efficient. You can
    also file_get_conten ts() the files into variables in the common.php
    file and then echo them, but then you have a lot of crap in memory.

    That is what I generally do for small, 5-10 page sites for businesses
    and stuff. Otherwise, I will use Smarty template engine or something
    similar (something similar usually means TemplateLite, which is faster/
    more efficient than Smarty). These template engines are the most
    advanced way to template your website. They are generally designed so
    you have to keep most HTML separate from PHP files. They are fast
    enough when you use them right.


    Download TemplateLite for free. A small fast Template Engine for PHP, without a huge framework. Template Lite is a very fast, small HTML template engine written in PHP. The engine supports most of the Smarty2 template engine functions and filters.


    -Mike PII

    Comment

    Working...