SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pass variable along with array to smarty

    Hi guys


    PHP Code:
     $iCurrent time();
    for(
    $iDays 1$iDays <= 60$iDays++)
    {

    $thedate date('Y-m-d 00:00:00'$iCurrent += 86400);
    $sql mysql_query("SELECT * FROM dates WHERE Start='$thedate' ");
    $number mysql_num_rows($result);



        
    $temp_array[] = date('D M dS, Y'$iCurrent += 86400),;
    }





    $smarty->assign("array",$temp_array);

    $smarty->display("chooseday.tpl");







    How can I pass $number along with the array ($temp_array[] ) to smarty?


    Regards


    Chris

  2. #2
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try adding these two lines:

    $smarty->assign("number",$number);
    $smarty->display("chooseday.tpl");

    I would not add number to the array[] assuming that array will all be displayed, which I do not think you want to happen.


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
  •