Re: [SMARTY] Object access
| From: | messju mohr | Date: | Thu, 06 Mar 2003 22:27:37 +0000 |
| Subject: | Re: [SMARTY] Object access | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8463@lists.php.net to get a copy of this message | ||
On Fri, Mar 07, 2003 at 09:12:57AM +1100, Tom Rochester wrote:
> messju,
>
> I understand this,
>
> '$obj->method outputs an associative array' should have read '$obj->method
>
> returns an associative array'
>
> But my example is not working it is not being assigned to $arr
>
> Thanks,
>
> Tom
>
> messju mohr wrote:
>
> >Hello,
> >
> >On Thu, Mar 06, 2003 at 03:43:32PM +1100, Tom Rochester wrote:
> >
> >
> >>How does one assign to output of an objects method?
> >>
> >>The manual states that {$obj->method p1="" assign="output"}
> >>should work
rrr, of course it should read
{obj->method p1=...} not {$obj->method p1=...}
is that the problem?
> >>but it doesn't. Also tried {$obj->method() assign="output"} but this
> >>simple outputs the array (ie "Array" is this getting closer?)
> >>
> >>Specific example:
> >>
> >>$obj->method outputs an associative array.
> >>
> >>index.tpl :
> >>
> >>{$obj->method p1="" assign="arr"}
> >>{foreach item="item" from=$arr}
> >>{$item}<br/>
> >>{/foreach}
> >>
> >>How can I achieve this functionality?
> >>
> >>Thanks,
> >>
> >>
> >
> >not the output of the method is assigned, but the return-value. also
> >the return-value is printed to the page if no "assign=" is given.
> >
> >so your methods should return their output, not echo it. then the
> >output can be assigned optionally.
> >
> >HTH
> >messju
> >
> >
> >
> >>Tom
> >>
> >>
> >
> >
> >
>
--
Torx-Schrauben: Hände-Weg-Schrauben
nach Marc Habers Kollegen