View Single Post
  #2 (permalink)  
Old 06-04-2007, 10:15 PM
allenp's Avatar
allenp allenp is offline
New Pligger
 
Join Date: Jun 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
To make a pulldown with the categories use the following php:

PHP Code:
        $catsql mysql_query("SELECT category_id, category_name FROM " table_categories " WHERE category_lang='$dblang' ORDER BY category_name ASC");
    
$categories = array();
    while (
$rows mysql_fetch_array ($catsqlMYSQL_ASSOC)) array_push ($categories$rows);
    
$main_smarty->assign('categories'$categories);

    include_once(
mnminclude.'dbtree.php');
    
$array tree_to_array(0table_categoriesFALSE);
    
$main_smarty->assign('lastspacer'0);
    
$main_smarty->assign('cat_array'$array); 
And this in the template:

PHP Code:
            <select name="category">
            {
section name=thecat loop=$cat_array}
               <
option value "{$cat_array[thecat].auto_id}">
                  {if 
$cat_array[thecat].spacercount lt $lastspacer}{$cat_array[thecat].spacerdiff|repeat_count:''}{/if}
                  {if 
$cat_array[thecat].spacercount gt $lastspacer}{/if}
                  {
$cat_array[thecat].spacercount|repeat_count:'&nbsp;&nbsp;&nbsp;'}
                  {
$cat_array[thecat].name
                  &
nbsp;&nbsp;&nbsp;       
                  {
assign var=lastspacer value=$cat_array[thecat].spacercount}
              </
option>
            {/
section}
        </
select
This is in submit.php and submit_step_2.tpl in the yget template if you want to see it in use.

Patrick
Reply With Quote