Jump to content

Need to make a change to a parent/child category function


jojomart

Recommended Posts

I hope someone can help me with this

 

I am using a directory script, but the category pull down menu in admin is not what I want. All it does is list the parent, and the child of the parent, not the child of the child. It makes it hard to find the subsubs easily this way. Some of my categories have 4 levels, but all it shows is:

 

Parent

child

child

child

 

with no indentation for the different subcategories.

 

Here's what I really want

 

Parent

- child

-- child of child

--- child of child of child

 

Here is the code:

#catRSelEditPage -- Recursive category select that stops when id is found
/* int $idF, mysql query result $fatherR, mysql connecion $myconn */
function catRSelEditPage($idF,$fatherR,$myconn){
   while($father = mysql_fetch_assoc($fatherR)){    
         if($father['id'] == $idF)
            $selected = ' selected ';
         if($father['fatherID'] == 0)
            print '<option value="'.$father['id'].'"'.$selected.'>*'.$father['title'].'</option>';
         else
            print '<option value="'.$father['id'].'"'.$selected.'>   '.$father['title'].'</option>';      
         $selected = '';
         $sql = "select * from categories where fatherID = '" . $father['id'] . "'";
         $R = mysql_query($sql,$myconn) or die(mysql_error());
         catRSelEditPage($idF,$R,$myconn);
   }//end while
}//end function 

 

Is there anyone out there who can help me, please?

 

Thanks,

Joanne

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.