Re: [SMARTY] Creating custom loop block function

Kaloyan Tsvetkov <[email protected]>
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
I did that. But then all my rows are populated with the values of the last
row. For example, the calls from the compiled version to <?php echo
$this->_tpl_vars['SKU']; ?> always return the {SKU} from the last row. It
seems to me all the loop iterations are done before accessing the first
{cell} block.

It seems that I am doing something wrong, but I can not figure it out.

On 12/23/05, messju mohr <[email protected]> wrote:
>
> On Fri, Dec 23, 2005 at 01:59:05PM +0200, Kaloyan Tsvetkov wrote:
> > On 12/23/05, messju mohr <[email protected]> wrote:
> > >
> > >
> > >
> > > wrong. reread
> http://smarty.php.net/manual/en/plugins.block.functions.php
> > > and maybe reread your compiled template.
> > >
> > >
> > >
> > OK, the Smarty docs state that:
> >
> >  The value of *$content* variable depends on whether your function is
> called
> > for the opening or closing tag. In case of the opening tag, it will be
> null,
> > and in case of the closing tag it will be the contents of the template
> > block. Note that the template block will have already been processed by
> > Smarty, so all you will receive is the template output, not the template
> > source.
> >
> > http://smarty.php.net/manual/en/plugins.block.functions.php
> >
> > So in order to make the {cell} calls work, I have to populate them in
> > advance by the {row}tag, right ? And this has to be done by the opening
> > {row} tag, right ?
>
> right. that's what I did in my example. or it could be done by the
> *opening* {cell} tag.
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.