Re: custom functions doesn't seem to pass variables
| From: | Francois Dumais | Date: | Sat, 22 Dec 2001 19:43:10 +0000 |
| Subject: | Re: custom functions doesn't seem to pass variables | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2374@lists.php.net to get a copy of this message | ||
Thanks Peter your solution works.
The cast pointer. Well, because I want to make complex pages templates
(tables embedding other tables, forms, text), I need to "decide": in advance
how my content will be distributed. To contain this casting plan, I need an
array to contain those instructions. Cast pointers are those instructions.
----- Original Message -----
From: "Peter Bowyer" <reywob@f2s.com>
To: "Francois Dumais" <f_dumais@videotron.ca>
Sent: Saturday, December 22, 2001 1:46 AM
Subject: Re: [smarty] custom functions doesn't seem to pass variables
> Hi Francois,
>
> At 04:09 AM 12/22/01 -0800, Francois Dumais wrote:
> >I have played and read about the custom functions. Somehow it doesn't
> >seem to pass variables. I have tried a lot of different combination, it
> >always send back the word "Array" when I try to echo the value. My
> >function works well since an "inside" echo with a string will be
displayed
> >from this custom function. It just doesn't have variable content when
> >it's pass as an argument:
> >
>
>/*======================================================================*\
> > Function: smarty_func_cast_content
> > Purpose: function to register cast pointers for a given page
>
>\*======================================================================*/
> >function smarty_func_cast_content($attribute)
> >{
> > $attribute.=$attribute;
> > echo $atribute;
> > echo "echo attribute: ".$attribute;
> > return $attribute;
> >}
>
> You are calling the function like:
> {cast_content attribute='somevalue'}
> ???
> Add this just after the { in your function:
> extract( $attribute );
> and all should be well.
>
> As an aside, what are cast pointers?
>
> Have a happy Christmas!
> Peter.
>
> --
> Maple Design - http://www.mapledesign.co.uk
>