Page 1 of 3 123 Last
  • Jump to page:
    #1
  1. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    CachedFastTemplate.php


    Once you have your presentation seperated from your logic with PHP Fast Templates you can then start to play with the clasess that extend PHP Fast Templates for caching. Caching can dramatically speed up the feel of your website and reduce the load. I predict we will start to see people splitting up pages into customized content and non-customized so they can cache the parts of the page that are the same for every viewer. Why generate the same thing on every page load? A 5-30 second delay is acceptable for most people. Caching to that degree could make it possible to easily survive a slashdoting :).
  2. #2
  3. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: CachedFastTemplate.php


    In my hast to post I forgot one non-obvious benefit. You can code complex dynamically generated menus and not have to worry about the cpu time it takes to generate it for each viewer (as you could make the cache hold the menu for 12 hours or until you manually flush the cache). Basically you don't have to optimize some parts of the page to the degree we now optimize them because the load will be low. Optimizing code takes time. Caching dynamic but slow changing html is a simpler solution.
  4. #3
  5. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Alternative


    Another way of doing it:
    <br />
    <br />
    $template = file ($DOCUMENT_ROOT . &quot;/templates/mypage.tmpl&quot;);
    <br />
    <br />
    $template = implode(&quot;&quot;, $template);
    <br />
    <br />
    $template = str_replace(&quot;<%title%>&quot;, $title, $template);
    <br />
    <br />
    Where your template file is only html + home made tags (<%keyword%>).
  6. #4
  7. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    PhpLib vs. FastTemplate


    Has anyone done any comparison between
    Fast Template and
    PHPLib Templating?
  8. #5
  9. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Template Variables


    I think you should use HTML style tags for your template variables. &lt;!--HOUSE--&gt; or maybe <%HOUSE%>
  10. #6
  11. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Any advantage when ...?


    Is there any advantage to using templates and template caching when the site is session enabled?
  12. #7
  13. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    seperating presentation from logic


    The note at the bottom of the article said that sometimes separation of presentation and logic could be overkill. But I say, “Do it right the first time.” When was the last time you were involved in a project that didn’t double in scope over 6 months? Separate presentation and logic now and you won’t be stuck doing it 3 months from now.
  14. #8
  15. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Is this wisdom generally accepted


    It seems to me that following an application that is written this way is more confusing than looking at a single script. There are two files instead of one and most well written pages are less than 20k. When there are a couple of includes and function files to play with - where the logic is used accross several pages so it has to be in a seperate file.

    I rekon that this style of programming takes what is often a very simple script and turns it into a maze of different files.

    Interested to see if this gets any reaction and if there is any concensus.....

    KIS ... less is more when it comes to the number of files to parse a page!

    Phil
  16. #9
  17. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Is this wisdom generally accepted


    I think that it depends on the size and scale of the site you are developing. If you are developing a site with 30 pages then keeping it simple is probably a good idea. However, if you have a site which is several hundred pages or more then it is probably a good idea to separate presentation from logic. Another comment mentioned that projects tend to grow over time so you may as well do it right the first time. One other thing to consider is how many people are involved. If it is only a couple of people and they share responsibilities then separation of presentation and logic is probably not necessary...however if the development team consists of numerous developers and they deal with different aspects of the site (such as graphic design, content, and application programming) then the separation of presentation from logic is probably a good idea.
  18. #10
  19. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Is this wisdom generally accepted


    The idea behind this is generally accepted, yes. However, the implementation isn't. It's a pain in the butt, frankly. Say I'm converting all my html pages to php fast template pages. Now consider the fact that I have a lot of static pages that have many paragraphs worth of text that needs to be entered into the templates... I'd have to go in and manually escape any quotes or special characters. Talk about a pain... and different templates for different numbers of paragraphs, etc.

    The best idea for this type of system is for data that you're pulling directly from a database. It's not generally a good idea for something like static sites - you're better off with just a couple of includes for the top and bottom to set the design.

    Also, template systems like these don't take into account stylized text, such as if the author of an article needs some bold or italicized text - you still have to embed HTML, which is exactly what they're trying to get away from.
  20. #11
  21. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Install example


    The examples aren't working. I get:

    <br>
    <b>Warning</b>: Invalid content of \{\} in <b>/home/tsawyer/public_html/FastTemplate/class.FastTemplate.php3</b> on line <b>213</b><br>
    <br>
    <b>Warning</b>: Invalid content of \{\} in <b>/home/tsawyer/public_html/FastTemplate/class.FastTemplate.php3</b> on line <b>213</b><br>
    <br>

    Anyone know what's wrong.
  22. #12
  23. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Download?


    I realy think you shall have a PDF version of all your tutorials and articles... Because we modem user likes to be offline:)
  24. #13
  25. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: CachedFastTemplate.php


    I am surprised that no one mentioned another template engine that is gainging in popularity... smarty. You can learn more about this template engine at http://www.phpinsider.com

    I would love to see a tutorial like this one showing how smarty differs and any benefits etc... I do know that it is a caching template system, and the developers are closely tied in with the developers of PHP itself.

    Anyway... something to look into.

    Alan
  26. #14
  27. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Is this wisdom generally accepted


    FastTemplate is not only great for creating clean code, it's also doing an excellent job in reusability, especially when you're working in a team where designers and programmers work together. Take a simple example: I wrote an e-cards class a while ago, completely based on templates, so the inner workings are seperated from the design. Nowadays this class is being reused for completely different sites with whole new layouts in a very short amount of time. And I don't even have to look at it. The designers change a few settings, recreate the template files and they're ready to upload.
    I dare not to think about working without templates all the time, seriously. For a simple design doing a few includes here and there might work, especially if the chance of having to reuse the code is relatively small, but our designers aren't really into simple designs, usually. I thought not using templates wouldn't be a big issue with just small stuff. It isn't, but development time increases quite a bit when using them while being in a team situation like I am. "Just a couple of includes for the top of the bottom to set the design" just doesn't do it in this company usually.
    Don't forget that creating static pages from dynamic data becomes a breeze when using a class like FastTemplate.
    I like templates a lot :-)
    That's just my 2 cents.
  28. #15
  29. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: PhpLib vs. FastTemplate


    Am I the only one scared of PhpLib? I just don't like loading large amounts of parsed code on every page. I can't help but think peformance issues would crop up.
Page 1 of 3 123 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo