SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard jimbo_dk's Avatar
    Join Date
    May 2005
    Location
    Singapore
    Posts
    1,261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why would I use Smarty?

    I've never really tried out Smarty Templates a lot. I always thought that was an over complication of something that could be done just as easily using just PHP.

    But recently some clients have requested their site use Smarty. So I'd like to know what's the main advantage(s) of using Smarty?

    Thanks in advance...
    Winners Respond. Losers React.
    Singapore Web Designer

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please visit the site itself will describe you the advantages.
    http://smarty.php.net/
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    SitePoint Wizard jimbo_dk's Avatar
    Join Date
    May 2005
    Location
    Singapore
    Posts
    1,261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the link Rajug, but I've already visited this site, and well, publisher's sites are usually biased. What I'm looking for is comments from current/past users of Smarty.
    Winners Respond. Losers React.
    Singapore Web Designer

  4. #4
    SitePoint Enthusiast uberhost's Avatar
    Join Date
    Jun 2007
    Location
    Southern California
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are CMS and e-commerce solutions that are encoded but make provision for using smarty (WHMCS comes to mind), so in this case it would be your only means of making certain changes without having the source code.
    UBERHOST.NET
    Shared, Reseller, Semi-Dedicated Hosting and Dedicated Servers
    cPanel or DirectAdmin Money-Back Guarantee 24/7 Support
    Providing "Service Above All Else" since 2005

  5. #5
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Is your question "should I use Templates?" or "should I use Smarty?".

    I haven't used Smarty, but I did try a simple Template system ( Richard! phpguru.org) many years ago.

    Its been the subject of much debate as can be seen here (work your way down the page)
    http://www.sitepoint.com/forums/show...marty+learning

    Search this and the PAD forum for Smarty and you will get even more info.

    This is probably an important document to read too;
    http://www.phppatterns.com/docs/desi...mplate_engines

    If you want to use Templates because you seek discipline in your efforts to seperate logic from HTML, then you might have a point in using them (personally I don't, I find them turgid - but then again I work largely in isolation).

    If you are going into a shop where all the HTML designers are used to using Smarty, then yes, it sounds like a job requirement.

    If you want to use a Template because you feel it will make your life easier, well, some would say its just another language to learn and remember - and debug.

    Up to you chap. Hth.

  6. #6
    SitePoint Wizard jimbo_dk's Avatar
    Join Date
    May 2005
    Location
    Singapore
    Posts
    1,261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the replies guys.

    Cups: Great links. I guess my question really is "should I use Templates?". I referred to Smarty because that was the templating system on my mind.

    After reading through I've re-enforced my initial thoughts that templating systems are really redundant add-ons, and "just another language to learn and remember - and debug".

    I mostly work in isolation as well. Even if I have to work with other designers, I don't think typing "<?php echo $name; ?>" instead of "{ $name }" would be that big of a deal.
    Winners Respond. Losers React.
    Singapore Web Designer

  7. #7
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The template, processing, and database access are three different layers which need to be implemented separately in order to make large to huge systems maintainable. If you only have a few dozen pages then jumbling these layers together will not make any significant difference since you can spend the extra time working out what part of the code belongs to which layer.

    The split between these layers is not as obvious as the split between the content, appearance, and behaviour layers as those layers use different languages while the template, processing, and database access layers all usually use the same language.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  8. #8
    SitePoint Wizard jimbo_dk's Avatar
    Join Date
    May 2005
    Location
    Singapore
    Posts
    1,261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    The template, processing, and database access are three different layers which need to be implemented separately in order to make large to huge systems maintainable. If you only have a few dozen pages then jumbling these layers together will not make any significant difference since you can spend the extra time working out what part of the code belongs to which layer.
    I see your point. The systems I handle right now are manageable enough. But I will remember this for the future.
    Winners Respond. Losers React.
    Singapore Web Designer


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •