Re: [SMARTY] Smarty plugin / modifier

From: Date: Thu, 02 Jun 2005 16:32:12 +0000
Subject: Re: [SMARTY] Smarty plugin / modifier
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12655@lists.php.net to get a copy of this message
--- Monte Ohrt <monte@ohrt.com> wrote: > You can make a modifier to do that, but the parameter syntax will > need to follow the rules, something like: > > {p} > {p h=10 w=5} I'm quite certain that Monte meant a function plugin there. Just to be clear and try to avoid confusion, a modifier plugin has a unique syntax compared to function plugins and the modifier name is always given after its first (required) parameter like so: {10|p:5}. If you were going to do a modifier, I might suggest that if only the first parameter is given, you assume dimensions of nxn (eg: {1|p} is 1x1 and {2|p} is 2x2 but {3|p:4} is 3x4}. However, unless you resort to filter tricks, you can *not* write {p} or even {|p} with a modifier. Then again you could register a function plugin for that specific case (in addition to the modifier). xo boots > You could also write a prefilter that will change this: > > {p:10:5} > > to this: > > {p h=10 w=5} > > Then you could get the brevity you are after. > > As for writing the modifier, there are instructions and examples in > the documentation. Feel free to post here or on the forum if you have > trouble. > > Monte > > Matija Rijavec @ domenca.si wrote: > > > Hi all. > > > > In my templates, i use a lot of <img src="pixel.gif" height="1" > > wifth="1"> ...... > > How can i make modifier / plugin for this ... like : > > {p} .... ordinary pixel.gif wiht widtht=1 and height=1 -- default > values > > {p:10:5} .... pixel.gif with width=10 and height=5 > > > > ... sorry if this isnt maillist for plugins/... > > > > Greetz.

« previous php.smarty.general (#12655) next »