Re: Internal Variables
| From: | Andrei Zmievski | Date: | Fri, 23 Feb 2001 16:34:24 +0000 |
| Subject: | Re: Internal Variables | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-204@lists.php.net to get a copy of this message | ||
On Fri, 23 Feb 2001, Alexander, Jason wrote:
> Thanks Andrei for the prompt response.
>
> Hrm, that's unfortunate. Hopefully (for self-serving reasons :D) you guys
> can get that in the next release.
>
> But, I understand your problem. Once you get into parsing the section
> directives, how do you (cleanly & easily) handle global directives, such as
> "declare", "set", and "unset" directives, hypothetically.
Ok, a possible implementation might look like this. Let me know what you
think.
{section name=my_list loop=$foo}
{$my_list/foo} {* indexing by current iteration *}
{$my_list.index/foo} {* still indexing by current iteration *}
{$my_list.index_prev/foo} {* indexing by previous iteration *}
{/section}
I am not sure about 'index_next', since there is already 'rownum' which
is index + 1. We could still have 'index_next' to be consistent. Or
should they be called 'next_index' and 'prev_index'?
-Andrei
'Any given program, when running correctly, is obsolete.'
- First Law of Computer Programming