Results 1 to 1 of 1
  1. #1
    Join Date
    Jan 2004

    Unanswered: Working with smarty

    Hi all
    if any body knows or is working with smarty then please help me out with this problem. I am totaly exhausted with this.
    Let me tell you about the senario.
    I have a events table which has a lots of events for different dates. Now I want to list these events for a week. I will get the first date of the week from the user. Now to pass the values to the smarty template I am using the the follow code

    this will store the title of the event. This perticulare code is in side the while loop that fetch the information from the DB,
    $result=mysql_query("select * from events where date='$sdate'");

    This way I get the information stored in some variable which can be accessed in smarty template. But the real issue is I have all this in a for loop, b'coz the $sdate keeps on changing. The $sdate keeps on incrementing for 7 days (a week) So this become like a 2 dimensional array.
    So now the code is like
    // $sdate gets incremented by date. I am not useing between in the query b'coz I want this to be sorted by date aswell events_priority
    $result=mysql_query("select * from events where date='$sdate' order by events_priority");

    Now in the template I have done some thing like this
    {section name=day loop=$sdate}
    print some information
    {section name=events loop=$event_title[day]}
    print another information { $events_title[day][events]}

    As per the smarty document this template is correct But still this is not working. Means the seconf section is not working.

    If my senario is not unstandable then please tell me how to pass information to smarty template from php so do the nested section
    {section name=customer loop=$custid}
    id: {$custid[customer]}<br>
    name: {$name[customer]}<br>
    address: {$address[customer]}<br>
    {section name=contact loop=$contact_type[customer]}
    {$contact_type[customer][contact]}: {$contact_info[customer][contact]}<br>

    Any help would be gr8

    Last edited by rajesh_r_r; 01-19-05 at 08:27.
    Freelance and Technology Consultant
    Dreams are for ever

Posting Permissions

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