Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Don't use plugins

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
hagman
Smarty Rookie


Joined: 18 Apr 2003
Posts: 10
Location: Östersund, Sweden

PostPosted: Wed Jun 18, 2003 7:59 pm    Post subject: Don't use plugins Reply with quote

(Most) modifier plugins are just pointless.

Code:
<b>{$var}</b>

is faster than
Code:
{$var|bold}


not much but when using alot of plugins more resourses is needed.
_________________
php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Wed Jun 18, 2003 8:09 pm    Post subject: Reply with quote

It won't be faster when your designer decides to replace all application bolded text (but not necessarily all instances of <b></b>) to something like <span style="font-decoration: underline;"></span>.

The whole point of abstraction is not to speed up runtime, but to help manage your development cycle. Remember, with caching, that still ends up as <b>whatever</b> in your output and in your compilation it is a straight function call to your plugin.

NOT POINTLESS.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Jun 18, 2003 8:20 pm    Post subject: Reply with quote

I agree that your particular example would be pointless... If all a modifier did was unconditionally wrap static tags around the variable then they surely would be pointless. However, the modifiers that come with Smarty typically adjust the variable content to some degree. Example:

{$title|upper}

This uppercases the variable. that's difficult to accomplish without a modifier or intervention from the application. So when you say most modifiers are pointless, I tend to disagree. I'd like to be shown which modifiers that come with Smarty are pointless.

Also, it is possible to make your example have a point to it by using for abstraction. Example:

{$var|bold}

This could be programmed to output one of the following depending on the browers capabilities:

<b>$var</b>

<span class="bold">$var</span>

Monte
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP