WordPress.org

Support

Support » Requests and Feedback » Smarty coming soon?

Smarty coming soon?

  • I have read the numerous posts around the place, and have also looked in the ‘future’ section of the site. I noticed there is discussion of including the smarty based template system into WordPress..
    This will probably be the deciding factor for me, if I should move to WordPress or not from bBlog.
    I love the flexibility that bBlog has through its smarty-centric code, where you have functions such as {getrecentposts} as well as modifiers for your posts, such as textile, bbcode etc which can all be changed about easily in the templates.
    I’m not a huge fan of the current ‘template system’ in WP, if it can actually be called that. The plugins architecture, from what i have looked at is also something that lacks a bit (don’t get me wrong, its great, but i’m just inlove with the way bBlog and smarty handle things).
    For an example of what i am talking about, take a look at the following templates that I use on my site (powered by bBlog) (please ignore my sloppy html and use of tables – this is something i plan on fixing sometime soon!)
    http://surfionline.com/bblog/templates/surfi2/index.html
    http://surfionline.com/bblog/templates/surfi2/footer.html
    http://surfionline.com/bblog/templates/surfi2/archives.html
    I do know some people aren’t real fans of the smarty-centric or smarty based template system, however i see it has numerous advantages.
    Chris
    http://www.surfionline.com

Viewing 15 replies - 1 through 15 (of 23 total)
  • From the code you’ve shown us, it looks to me like a modified version of PHP. Why do this when you have direct access to PHP in the form of plugins and even modifying the core files yourself (though that isn’t recommended)?
    Smarty tags may be fine for small code, but when you have an interpreter interpreting code and that code interpreting it’s own seperate code, well, you run into speed issues.
    This just seems like a big waste of time to me.

    Well, it could be alot simpler and done directly in PHP, I just did it this way to save some time for myself, instead of stuffing about finding out exactly where in bBlog things happen (which is a lengthy process). I know in WordPress the code is a lot cleaner and easier to follow though.
    I find that using smarty is a quicker alternative to actually editing the core and the code. It allows the flexibility. I could have done the complicated things i chose to do in the PHP files, but i just chose to make my own templates a mess.
    But these are just my opinions on the template system and design.

    Actually, Smarty builds php files from the templates and stores them in cache until the original template is changed. When the page is displayed the second time, it’s executing PHP code.
    Nonetheless, I agree that it seems less flexible to use the Smarty templates than native PHP.

    Going by what I am about to say now, I am probably about to completely contradict what I have previously said about smarty..
    Using native PHP for templates cannot really be called a template system. Isnt the idea to remove the php related things and just provide straight HTML logic in the templates? (Yep, I have contradicted myself).. I know that you cant really call smarty a template system either if we go like that due to the advanced nature’s it supports such as {if} and {foreach}.
    Being a developer of forum software, the template system is something that I am always looking at. I have currently opted to stay with the basic template system design of just HTML in the templates, and calling extra templates in the PHP then assigning them to a variable when needed.

    Sorry, but index.php IS the template. It is just a default. To call it any more than that is misrepresenting the system.
    Now, you CAN do huge changes to the look and feel of your blog without touching index.php, just modifying wp-layout.css. But, EEEK, wp-layout.css might change with updates too! Which means it is really just a default as well..
    I like having a minimal set of places I change things. Since there are logic functions (if-then, loop, test) I want integral to my template, I wouldn’t want to base them out in some other file. That doesn’t make things easier, just spreads out content creation that much more. Well, just IMHO! 🙂
    -d
    CHAITGEAR

    index.php never changes… I’ve had the same one through all the betas and probably could have safely used the one from 1.02
    There are 3 files I never touch when I update or patch: index.php wp-layout.css (although I renamed it) and wp-comments.php
    I do have to keep editing wp-functions/links.php to clean up the ul/li the way I like it though.

    index.php DID change from one of the 1.0.x releases to 1.2 because I posted on here about it (http://wordpress.org/support/3/5969
    It may have been a bug in the older version, but when I tried to keep index.php from my old version I got the bad wrong behavior.

    Out of curiosity, what is the class-smarty.php for?
    And yes, if there won’t be smarty templates please more API hooks. Especially in the backend so that plugins can tie in with the administrative functions as well.

    Having been through the PHP vs. template systems argument again and again, I came to the conclusion that PHP is best; however, if I was designing software like WordPress I would use a template system like smarty.
    Why?
    Because if you want to have plug-and-play, shareable templates, then using PHP is a massive security vulnerability. An attacker can post a whiz-bang set of template files that also contain malicious code.
    In a template system, you are limited in what the template files can do, so you can install 3rd-party template files without worry.

    Furthermore, what if WordPress moves to a multiple-blog setup like MoveableType, and you want each user to be able to customize his own template? Surely you don’t want all those users having access to PHP where they can wreak havok.

    The point that patmitz point out there, about plug-and-play templates is a very good one. I would have to agree about the multiple-blog setup idea too.
    I am disappointed that we wont be seeing smarty anytime soon in WordPress, or even another template system (even a basic one).
    If i give my little brother a smarty template he can pretty much understand all of it, even some of the logic. I let him look at WordPress’ index.php and he was confused..
    Chris

    I’m really keen on smarty. I’m a reasonably experienced php programmer, but smarty has a number of (really good) benefits:

    • Multiple templates easy – just put the directory in your templates/ dir, and change a select box in the admin section. Good for a change, or as mentioned above, for multiple users.
    • Separation of presentation from content from code. Smarty is purely presentation, and lets you just worry about the design, without even having to worry about what the code is doing.

    In addition, there isn’t that much extra overhead, and it takes about 5 minutes to learn. This is the one feature that may keep me on bBlog – it’s a tough decision.

    @chris Bouton–
    “I am disappointed that we wont be seeing smarty anytime soon in WordPress, or even another template system (even a basic one).”
    While it’s been stated many, many times that Smarty is not the right fit for WordPress, who has said that we won’t be seeing any kind of a template system?
    Also, a general comment to all — this is not MT. It should not be “like” MT. No single piece of software will ever please all people. However, I believe 100% in the dev team. That’s not to say that I always agree with them, because I don’t. The thing is, if you really want MT-functionality, well, you have an option for that. I would shudder to think of WP evolving into an MT clone. Yikes!
    That being said, there is lots of room for innovation. The plugins are coming fast and furious, and they are adding a lot of great things to the WP experience.
    WordPress is still the new kid on the block, and already it’s kicking ass. Just wait until you see what the future holds.

    @NuclearMoose–
    “Also, a general comment to all — this is not MT. It should not be “like” MT. No single piece of software will ever please all people. However, I believe 100% in the dev team. That’s not to say that I always agree with them, because I don’t. The thing is, if you really want MT-functionality, well, you have an option for that. I would shudder to think of WP evolving into an MT clone. Yikes!”
    I haven’t really checked out MT, because of the fact that its written in perl. MT has logic in templates?
    “That being said, there is lots of room for innovation. The plugins are coming fast and furious, and they are adding a lot of great things to the WP experience.”
    Thats true, and some are excellent, its just there isnt enough ‘extendability’ and functionality with the included hooks etc.

    As much as I like Smarty, and personally think that WP would be adding some easy functionality by using it, I can understand developers of WP not wanting to use it and opting for something else to replicate template functionality.
    It sounds like Smarty’s definitely out of the picture, so I don’t understand why it’s listed here: http://wordpress.org/about/future/. Should it perhaps says “templating” instead?
    Some form of easy templating should be done. I really don’t think sticking things in a .php file is the best solution, since with Smarty you assign variables to the class and you pick a template and voila. So it’s easy to switch stuff around, with an index.php as the template file, well … it’s not dynamic. Smarty also takes care of caching and other things. It’d be nice to see all these things handled in WP.

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Smarty coming soon?’ is closed to new replies.
Skip to toolbar