Re: [SMARTY] Object access

From: Date: Thu, 06 Mar 2003 09:26:08 +0000
Subject: Re: [SMARTY] Object access
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8430@lists.php.net to get a copy of this message
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 > 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

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