All,

I have a data structure like this:

$favouritesMenu = [ { 'name' => 'Mobility Solutions', 'id' => '00021', 'children' => [] }, { 'name' => 'Rob', 'id' => '00030', 'children' => [ { 'name' => 'Mobility Solutions', 'id' => '00021', 'children' => [ { 'name' => 'RSA SecurID/Remote VPN New User + Request - Self', 'id' => '00032', 'children' => [] }, { 'name' => 'RSA SecurID/Remote VPN New User + Request - Other', 'id' => '00039', 'children' => [] }, { 'name' => 'RSA SecurID/Remote VPN Expiry', 'id' => '00044', 'children' => [] }, { 'name' => 'RSA SecurID/Remote VPN Dormancy +', 'id' => '00040', 'children' => [] }, { 'name' => 'RSA SecurID/Remote VPN Delete', 'id' => '00041', 'children' => [] }, { 'name' => 'RSA SecurID/Remote VPN Existing + User', 'id' => '00046', 'children' => [] }, { 'name' => 'RSA SecurID/Remote VPN Challeng +e and Response (ID&V) Details', 'id' => '00045', 'children' => [] }, { 'name' => 'RSA SecurID/Remote VPN Third Pa +rty Request', 'id' => '00042', 'children' => [] }, { 'name' => 'Broadband Request - Home, Offic +e & Branch', 'id' => '00043', 'children' => [] } ] } ] } ];
And want Template Toolkit to output the data in the following format:
<ul> <li>Mobility Solutions</li> <li> Rob <ul> <li> Mobility Solutions <ul> <li>RSA SecurID/Remote VPN New User Request - Self +</li> <li>RSA SecurID/Remote VPN New User Request - Othe +r</li> <li>RSA SecurID/Remote VPN Expiry</li> <li>RSA SecurID/Remote VPN Dormancy</li> <li>RSA SecurID/Remote VPN Delete</li> <li>RSA SecurID/Remote VPN Existing User</li> <li>RSA SecurID/Remote VPN Challenge and Response +(ID&V) Details</li> <li>RSA SecurID/Remote VPN Third Party Request</li +> <li>Broadband Request - Home, Office &amp; Branch< +/li> </ul> </li> </ul> </li> </ul>

I'm guessing that because I had to use a recursive sub to create the data structure I'm going to have to use something similar to output the data.

Many thanks
Rob


In reply to Recursion in Template::Toolkit by purinkle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.