Re: custom functions
| From: | Monte Ohrt | Date: | Thu, 21 Feb 2002 20:16:11 +0000 |
| Subject: | Re: custom functions | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2821@lists.php.net to get a copy of this message | ||
Ok, it has the right value. So what's the problem?
george wrote:
>
> This is being passed from the template
> Array ( [path] => images )
>
> George
>
> At 13:57 21/02/2002 -0600, Monte Ohrt wrote:
> >use print_r($params) in your function to see what is being passed in,
> >maybe that will help debug what is going wrong.
> >
> >george wrote:
> > >
> > > I am afraid that hasn't cured my problems,
> > > I can get it to work if I remove $path from my function and replace it with
> > > "images" which is the directory where the images are stored.
> > > but {getimage path="images"} doesn't work
> > >
> > > George
> > >
> > > At 11:17 21/02/2002 +0100, Ivo Jansch wrote:
> > > >Hi,
> > > >
> > > >george wrote:
> > > >
> > > >> getimage("images") and echo the value of $path it returns
> > > >> images, but
> > > >> when I place it within Smarty.addons and call it from a template the and
> > > >> echo the value of path it's "Array" ??
> > > >
> > > >
> > > >That's because of the way Smarty passes params to you.
> > > >
> > > >If your function is normally this:
> > > >
> > > >function func_getimage($path)
> > > >{
> > > > // lalalalala...
> > > >}
> > > >
> > > >then when using it in smarty, change it to this:
> > > >
> > > >function smarty_func_getimage($params)
> > > >{
> > > > $path = $params["path"];
> > > > // lalalalalala
> > > >}
> > > >
> > > >then it should work.
> > > >
> > > >Greetings,
> > > >Ivo
> > > >
> > > >--
> > > >Ivo Jansch <ivo@ibuildings.nl>
> > > >ibuildings.nl BV - information technology
> > > >http://www.ibuildings.nl
> > > >
> > > >
> > > >
> > > >---
> > > >You are currently subscribed to smarty as:
> > chiefmonkey@wisemonkeydesign.co.uk
> > > >To unsubscribe send a blank email to $subst('Email.Unsub')
> > > >Visit Smarty's homepage at
> > > >http://www.phpinsider.com/php/code/Smarty/
> > >
> > > ---
> > > You are currently subscribed to smarty as: monte@ispi.net
> > > To unsubscribe send a blank email to $subst('Email.Unsub')
> > > Visit Smarty's homepage at
> > > http://www.phpinsider.com/php/code/Smarty/
> >
> >--
> >Monte Ohrt <monte@ispi.net>
> >http://www.ispi.net/
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/