At 9:45 PM on 21 May 2008, R. Hicks wrote:
> I have a menu:
>
> [% menu = [
> {
> mode = 'home'
> text = 'Home'
> type = 'list'
> }
> {
> mode = 'who'
> text = "Who it's for & why?"
> type = 'list'
> }
> ]
> %]
>
> I have a page variable:
>
> [% page = 'who' %]
>
>
> Both of those are defined at the top of the page...
>
>
> I have a FOREACH going like:
>
> [% FOREACH item IN menu %]
> [% IF item.type == "list" && item.mode == page %]
> <li class="list-current">[% item.text %]</li>
> [% ELSE %]
> <li>[% item.text %]</li>
> [% END %]
> [% END %]
>
> That doesn't seem to be working.
Here's what I get when I copy and paste your code into tpage:
---
[EMAIL PROTECTED]:~[18:59]$ tpage > tpage-output
[% menu = [
{
mode = 'home'
text = 'Home'
type = 'list'
}
{
mode = 'who'
text = "Who it's for & why?"
type = 'list'
}
]
%]
[% page = 'who' %]
[% FOREACH item IN menu %]
[% IF item.type == "list" && item.mode == page %]
<li class="list-current">[% item.text %]</li>
[% ELSE %]
<li>[% item.text %]</li>
[% END %]
[% END %]
[EMAIL PROTECTED]:~[18:59]$ cat tpage-output
<li>Home</li>
<li class="list-current">Who it's for & why?</li>
[EMAIL PROTECTED]:~[18:59]$
---
What are you expecting for output? And what do you get instead? Does
mine look like it's working to you?
TTYL.
--
C. Chad Wallace, B.Sc.
The Lodging Company
http://www.skihills.com/
OpenPGP Public Key ID: 0x262208A0
Debian Hint #28: If your machine is not on all of the time (such as a
laptop), check out the 'anacron' package; this will make sure that
regular tasks still happen, even if the machine isn't on at the time
they would normally trigger.
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates