Loading ...
Sorry, an error occurred while loading the content.

[Cheetahtemplate-discuss] Reiterating over lists in templates

Expand Messages
  • Keith Edmunds
    I have a template that iterates a list, and within each list item iterates over (the same) list of options. The list of options displays for the first list
    Message 1 of 2 , Oct 1, 2006
    • 0 Attachment
      I have a template that iterates a list, and within each list item
      iterates over (the same) list of options.

      The list of options displays for the first list item but not for any
      subsequent items. It seems as if the option list needs to somehow be
      reset before attempting to reiterate.

      Pseudo code:

      #for $item in $items
      Item: $item, options:
      #for $option in $options:
      echo $option  
      #end for
      #end for

      How can I have the options iterate for every item in the outer list?

      Thanks.

      -------------------------------------------------------------------------
      Take Surveys. Earn Cash. Influence the Future of IT
      Join SourceForge.net's Techsay panel and you'll get the chance to share your
      opinions on IT & business topics through brief surveys -- and earn cash
      http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • Tavis Rudd
      Hi Keith, what is the type of $options? Is it a list, tuple or some sort of iterator? How about this? #set optionsStr =   .join(options) #for $item in
      Message 2 of 2 , Oct 2, 2006
      • 0 Attachment
        Hi Keith,
        what is the type of $options? Is it a list, tuple or some sort of
        iterator?

        How about this?
        #set optionsStr = ' '.join(options)
        #for $item in $items: Item: $item, options: $optionsStr

        Tavis

        On Sun, 1 Oct 2006, Keith Edmunds wrote:

        > I have a template that iterates a list, and within each list item
        > iterates over (the same) list of options.
        >
        > The list of options displays for the first list item but not for any
        > subsequent items. It seems as if the option list needs to somehow be
        > reset before attempting to reiterate.
        >
        > Pseudo code:
        >
        > #for $item in $items
        > Item: $item, options:
        > #for $option in $options:
        > echo $option  
        > #end for
        > #end for
        >
        > How can I have the options iterate for every item in the outer list?
        >
        > Thanks.
        >
        > -------------------------------------------------------------------------
        > Take Surveys. Earn Cash. Influence the Future of IT
        > Join SourceForge.net's Techsay panel and you'll get the chance to share your
        > opinions on IT & business topics through brief surveys -- and earn cash
        > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
        > _______________________________________________
        > Cheetahtemplate-discuss mailing list
        > Cheetahtemplate-discuss@...
        > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
        >

        -------------------------------------------------------------------------
        Take Surveys. Earn Cash. Influence the Future of IT
        Join SourceForge.net's Techsay panel and you'll get the chance to share your
        opinions on IT & business topics through brief surveys -- and earn cash
        http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
        _______________________________________________
        Cheetahtemplate-discuss mailing list
        Cheetahtemplate-discuss@...
        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
      Your message has been successfully submitted and would be delivered to recipients shortly.