Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Feb 2005
    Location
    Canada
    Posts
    435
    Member #
    8983
    I have been working on a project, using PHP and have been debating on whether to use a templating engine. I have come up with several solutions, each with different pros and cons, and just wanted a second (or many) opinions on personal experience, and effectiveness.

    SMARTY
    ---------

    This templating engine is so far the most powerful one I have seen.
    The pros
    [LIST][*]Allows for Loops, and other functions (more versatile)[*]Well supported/documented[*]completely separates the markup from the code

    The cons:
    • It's a large, and can be slow
    • It's not an easy install (ie for a single use)
    • You need to learn the syntax in order to use it
    • newest version is PHP5 only (not an issue unless webhost won't provide)


    Basic tag replacement (including STR_REPLACE ETC...)

    the pros
    • smaller then smarty
    • simple to use requiring only to know basic syntax
    • no installation necessary


    The cons
    • Can become complicated to use LOOPS, otherwise takes away customizability
    • if not written correctly, can slow down execution
    • may introduce security holes (in the case of hand built solutions)

    PHP
    Using PHP to assign variables, and then echoing them into the code functionally separating the code from presentation layer

    the pros
    • No installation
    • fastest solution
    • takes advantage of browser caching with a high level of effectiveness
    • no new language to learn

    the cons
    • unleashes the power of PHP in your templates
    • can bring security holes
    • your layout artist if not a PHP person may break the script
    • if using
      PHP Code:
      <?=$tag?>
      shorthand it may become unsupported.
    Thee Pyro Wolf

  2.  

  3. #2
    Senior Member raspberryh's Avatar
    Join Date
    Aug 2004
    Location
    Erie, PA
    Posts
    882
    Member #
    7208
    Liked
    1 times
    Maybe try looking into QuickTemplates... The problem with Smarty is that the loops / logic is right in with the HTML. It makes it really messy and hard to maintain. With QuickTemplates, all the logic is done in PHP, and you just have blocks delineated in the HTML (with special HTML comments). Then for example, in the PHP, you'd loop through a block and set its variables, and then parse & display it. It's also super easy to use & set up (in my opinion).
    choosy developers choose gif!
    website | paintings | blog

  4. #3
    Senior Member
    Join Date
    Feb 2005
    Location
    Canada
    Posts
    435
    Member #
    8983
    Quote Originally Posted by raspberryh
    Maybe try looking into QuickTemplates... The problem with Smarty is that the loops / logic is right in with the HTML. It makes it really messy and hard to maintain. With QuickTemplates, all the logic is done in PHP, and you just have blocks delineated in the HTML (with special HTML comments). Then for example, in the PHP, you'd loop through a block and set its variables, and then parse & display it. It's also super easy to use & set up (in my opinion).
    Thanks, much appreciated. I think the biggest issue I have with smarty, is that it is a terrible difficulty to install, and especially on my testing server I don't wish to spend a lot of time on configuration.
    Thee Pyro Wolf


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:17 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com