SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    Maniacally depressed robot poncho's Avatar
    Join Date
    Dec 2004
    Location
    Belfast, N.Ireland
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Smarty syntax help

    Hey guys,

    I'm having a syntax problem with Smarty's {section} function.

    I have an array being passed to smarty (it's actually a QuickForm date element with three sub-elements, d M & Y) and would like to loop on that according to a set number:

    The entire form is assigned to 'form_data' smarty variable.

    Code:
    <span>{$form_data.eventdates.label}<br />
    {$form_data.eventdates.html}
    </span>
    This outputs the date element as:

    Code:
    <select name="eventdates[d]">
    <!-- options here //-->
    </select>
    <select name="eventdates[M]">
    <!-- options here //-->
    </select>
    <select name="eventdates[Y]">
    <!-- options here //-->
    </select>
    I need to duplicate this as many times as is needed according to the {$num_dates} variable.

    If I do it with the html renderer I get (pseudo-code):
    Code:
    'eventdates[0][d]','eventdates[0][M]','eventdates[0][Y]'
    'eventdates[1][d]','eventdates[1][M]','eventdates[1][Y]'
    'eventdates[2][d]','eventdates[2][M]','eventdates[2][Y]'
    Can anyone help me get the same result with Smarty? I just can't seem to get it working

    I've got a rough example up on dev.burodefunk.com/qf/ of the form using the default renderer. Any help would be appreciated.

    Thanks in advance;
    Poncho
    Last edited by poncho; Sep 10, 2005 at 03:09. Reason: Added example code
    Perfecting the art of breaking stuff.
    Check 'em: CakePHP | TextMate


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •