Re: Smarty Help Anyone

From: Date: Sat, 13 Oct 2001 13:52:11 +0000
Subject: Re: Smarty Help Anyone
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70981@lists.php.net to get a copy of this message
Hello, it's pretty easy. You make a $value and an $output array with your current code and add the following to the template: <select name=""> {html_options values=$value selected=$selected output=$output} </select> if you provide any more detail, we can go further. - the posted code is not a valid PHP code. :( ----- Original Message ----- From: "Chad Guilette" <chad@guilette.net> To: <php-general@lists.php.net> Sent: Saturday, October 13, 2001 6:41 AM Subject: [PHP] Smarty Help Anyone Hey all....I hope someone has some experience with smarty... here's my situation, code and all...it's kind of messy but it works non-templated... $dbox_data = get_cat_forum_data($dropbox_count, 1, $user_information[0][3]); //This is my query that returns a result set an the number of records found into the variable $dropbox_count for($loop_box = 0; $loop_box < $dropbox_count; $loop_box++) { echo $dbox_data[$loop_box][0] //Print out group label $category_id2 = $dbox_data[$loop_box][1]; //Assign the unique group number to a variable while ($dbox_data[$loop_box][1] == $category_id2) //While the unique_id in the data is = to the assigned Id we loop { <option value="$BOARD_DIR/viewforum.php?c=" . $dbox_data[$loop_box][1] . "&f=" . $dbox_data[$loop_box][2] . "">----" . $dbox_data[$loop_box][3] . "</option> $loop_box++; //This loop prints out all of the elements as option values underneath the group header } $loop_box--; } Basically this code generates a dropbox something like this GroupValue1 ---Value1 ---Value2 GroupValue2 ---Value1 GroupValue3 ---Value1 But how do I template this with Smarty? Up to this point it was pretty smooth sailing...If anyone has any input or could point me to an example similar to this one it would be appreciated Chad Guilette

« previous php.general (#70981) next »