Title: Smarty Anyone?
Last modified: August 19, 2016

---

# Smarty Anyone?

 *  [randomblink](https://wordpress.org/support/users/randomblink/)
 * (@randomblink)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/smarty-anyone/)
 * I’m wondering if anyone has gotten Smarty to work for their WordPress installation?
   I’m an OLD (OLD, OLD, OLD) school Postnuke / Zikula Developer who is trying to
   get WordPress figured out so I can help a blogger friend of mine with custom 
   theme development and I am CERTAIN someone has a Smarty Installation working 
   inside WordPress.
 * Smarty is the best for theme development and I’m really hoping someone can point
   me to a plugin / theme that uses it for WordPress.
 * (crosses fingers)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/smarty-anyone/#post-1143799)
 * Not sure that’s such a good idea. WordPress has it’s own templating system, so
   you’d be effectively using a template engine to design a theme for a templating
   system, yes? OTT? 🙂
 * If you’re used to Smarty, WP should be a snip to use. Start with [http://codex.wordpress.org/Theme_Development](http://codex.wordpress.org/Theme_Development)
   
   and then bookmark [http://codex.wordpress.org/index.php?title=Template_Tags](http://codex.wordpress.org/index.php?title=Template_Tags)
 *  Thread Starter [randomblink](https://wordpress.org/support/users/randomblink/)
 * (@randomblink)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/smarty-anyone/#post-1144145)
 * Well, I’ve developed some seriously complex modules for Postnuke (which uses 
   a SMARTY theme engine) and WordPress themes look like Greek to me. I’m highly
   comfortable with PHP, HTML, and CSS but the engine used to build a WordPress 
   is chaos at best compared to what a SMARTY driven theme would look like.
 * No Theme Developer should ever have to worry about PHP syntax. SMARTY takes care
   of that for them.
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/smarty-anyone/#post-1144146)
 * Looking at the example on the smarty site i’d say i’d disagree it’s any easier,
   you’d still have to learn a new syntax if you’re a non-coder…
 * To anyone who knows HTML and CSS, but not PHP this..
    `{foreach from=$data item
   ="entry"}` [one snippet from the example on the smarty site]
 * makes no more sense then a PHP equivalent to a user not familiar with the syntax..
 * WordPress templates are written in CSS, HTML and PHP, there’s nothing more to
   it, other then calling a function here and there, but the syntax is the same 
   as you’d use for regular PHP, no special syntax, unlike the smarty code..
 * I’m trying to look at this with a non-bias approach but having a hard time because
   i can write PHP, HTML and CSS and can’t see how Smarty could offer me anything
   that i can’t do already… you’ll have to sell me on it with something a bit more…
 * If you know HTML and CSS, you can write templates in WordPress just as easily
   as in Smarty (i’d be willing to argue easier), because there’s still additional
   syntax in the files that require understanding… whether that be PHP or Smarty
   code is apples for oranges… personally i think the syntax looks horrible and 
   i’d rather stick with regular style PHP, not some special syntax.
 * Don’t let my comment be a turn off for anyone though, compare the difference 
   between the two types.. (i’ll have to make imaginary equivalents for the PHP 
   example)
 * Smarty:
 *     ```
       {* Smarty *}
   
       <form action="{$SCRIPT_NAME}?action=submit" method="post">
       <table border="1">
           {if $error ne ""}
               <tr>
                   <td bgcolor="yellow" colspan="2">
                       {if $error eq "name_empty"}You must supply a name.
                       {elseif $error eq "comment_empty"} You must supply a comment.
                       {/if}
                   </td>
               </tr>
           {/if}
           <tr>
               <td>Name:</td>
               <td><input type="text" name="Name" value="{$post.Name|escape}" size="40"></td>
           </tr>
           <tr>
               <td valign="top">Comment:</td>
               <td><textarea name="Comment" cols="40" rows="10">{$post.Comment|escape}</textarea></td>
           </tr>
           <tr>
               <td colspan="2" align="center"><input type="submit" value="Submit"></td>
           </tr>
       </table>
       </form>
       ```
   
 * PHP equivalent:
 *     ```
       <?php get_header(); // If this page required the include for the header ?>
       <form action="<?php bloginfo('url'); // Depends what you're doing ?>" method="post">
       <table border="1">
       <?php if($error) { ?>
               <tr>
                   <td bgcolor="yellow" colspan="2">
                       <?php echo $error; ?>
                   </td>
               </tr>
          <?php } ?>
           <tr>
               <td>Name:</td>
               <td><input type="text" name="Name" value="<?php echo $somevar['name']; ?>" size="40"></td>
           </tr>
           <tr>
               <td valign="top">Comment:</td>
               <td><textarea name="Comment" cols="40" rows="10"><?php echo $somevar['comment']; ?></textarea></td>
           </tr>
           <tr>
               <td colspan="2" align="center"><input type="submit" value="Submit"></td>
           </tr>
       </table>
       </form>
       <?php get_footer(); // If we're calling the header, then we likely want the footer to ?>
       ```
   
 * By all means if i’m missing something point it out, i just thought your point
   was the WP templating system is hard to use(or even in comparison), which could
   not be further from the truth (impo), i’ve used a a few CMS systems over the 
   years, including PHPNuke (i know shocking), DragonflyCMS (formerly CPGNuke) and
   a few others, and none of them were as easy and friendly to use as the WordPress
   templating system..
 * p.s. Where’s my free smarties?… 🙁 … the thread title had me thinking of chocolate…
 *  Thread Starter [randomblink](https://wordpress.org/support/users/randomblink/)
 * (@randomblink)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/smarty-anyone/#post-1144149)
 * Hmmmm… how to explain.
 * If you haven’t used SMARTY before in any fashion, and WordPress is your current
   fave, then it would be hard to compare.
 * Suffice it to say… escaping to php with <?php etc can be brutal for someone who
   is a Web Developer versus a Web Programmer.
 * A template for an HTML page should NOT have code escapes, using SMARTY allows
   you to have JUST HTML on your page. Using the WordPress templating, you have 
   to make sure you escaped your PHP correctly, is this an open tag or a close tag.
   And for newbies to Web Development, forget about it. My buddy has done several
   personal sites for his artwork in HTML but when he looked at the WordPress template
   layout he was lost. I feel that were SMARTY to be used, it wouldn’t be an issue.
   It’s intuitive. <p class=”{$QuoteStyle}”> is WHOLE lot easier than <p class=”
   <?php $_QuoteStyle ?>”>. First off, it’s cleaner. Secondly, it just intuitively“
   makes sense” to a non-programmer. It separates out the code from the style. Which
   is EXACTLY what the web is moving towards. (at least the forward thinking web
   apps)
 * It just makes more sense.
 * Sure, if you’ve USED WordPress for years, then what is there just makes sense.
   But having been with ONE CMS (Postnuke -> Zikula) since the late 90’s, and having
   seen WordPress-like Templating update to a separation of coding and styling with
   a plugin like SMARTY, it just makes life easier.
 * Of course, as all things on this planet, this is just an opinion. *shrugs*
 * I have discovered a walkthrough for integrating SMARTY, I’ll just be using that
   and shutting up for now. Should I stick with WordPress (doubtful after I’ve gotten
   my buddies site up) I might try to get an actual integrated plugin built and 
   running. I’ve met a few people who started it and gave up due to what they called“
   the chaos of the code that is WordPress.”
 * *again shrugs*
 * Peace
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/smarty-anyone/#post-1144158)
 * Chaos, hmmm… i don’t know about that, the reason i came to WordPress was partly
   due to it’s ease of use..
 * If you’re use to the Smarty syntax, then naturally having to switch to PHP escapes
   would seem like chaos…
 * You can click on my profile link and see how long i’ve been using WordPress (
   since earlier this year), so i’m no expert, i’ve just picked it up fairly fast
   in that time (or at least i feel i’ve picked up quite alot).
 *     ```
       {$QuoteStyle}
       ```
   
 * How is that no different then an escape sequence?… will smarty render that correctly
   if it were..
 *     ```
       {$QuoteStyle
       ```
   
 * If not, then it’s no different then remembering..
 *     ```
       <?php ?>
       ```
   
 * over..
 *     ```
       { }
       ```
   
 * You still ultimately end up with some enclosing characters for the commands, 
   and you still have a set of them to remember, but obviously under a different
   syntax.
 * I’ll agree yes it looks less threatening and easier, but i’d still opt for recommending
   PHP because you can carry across PHP know-how to so many more places, more places
   then you’d be able to use Smarty.
 * Learning PHP would not only allow more control over your templates, but also 
   give insight in how to write applications or scripts (and help you grasp ones
   you’re using already), learning Smarty just teachs you how to write Smarty, that’s
   only going to carry across to other “Smarty enabled apps”, and i’d guess that’s
   a far less number then apps that utilise PHP..
 * I’ll also agree it’s possibly an easier learning curve in some cases with Smarty,
   but like i said where can you carry that understanding along to utilise elsewhere
   when compared with PHP?..
 *  [Peter Boosten](https://wordpress.org/support/users/pboosten/)
 * (@pboosten)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/smarty-anyone/#post-1144159)
 * I don’t think it’s possible to combine WordPress with Smarty: Smarty separates
   the business logic from the templating (which in some cases can be a good thing).
   The business logic is supposed to deliver vaiables (in PHP arrays) to the templating
   engine, which then is responsible for the layout.
 * WordPress functions however deliver (in many cases anyway) pure html elements(
   like li’s for menus), and pure html is covered in Smarty, not in the busness 
   logic
 * That alone would require you to perform SQL statements from your wordpress installation,
   and then the need for wordpress would be reduced to nil.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Smarty Anyone?’ is closed to new replies.

## Tags

 * [development](https://wordpress.org/support/topic-tag/development/)
 * [smarty](https://wordpress.org/support/topic-tag/smarty/)

 * 6 replies
 * 4 participants
 * Last reply from: [Peter Boosten](https://wordpress.org/support/users/pboosten/)
 * Last activity: [16 years, 9 months ago](https://wordpress.org/support/topic/smarty-anyone/#post-1144159)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
