Visa ett inlägg
Oläst 2013-07-19, 05:18 #20
Conny Westh Conny Westh är inte uppkopplad
Klarade millennium-buggen
 
Reg.datum: Aug 2005
Inlägg: 5 166
Conny Westh Conny Westh är inte uppkopplad
Klarade millennium-buggen
 
Reg.datum: Aug 2005
Inlägg: 5 166
Citat:
Ursprungligen postat av Anaxa Visa inlägg
Jag löste det genom att lägga till en parameter till identeringsfunktionen. Tack för hjälp .

PHP-kod:
function intendChildren($children$growth) {
                                        foreach(
$children as $row) {
                                            
$intend "";
                                            for(
$i=0;$i<$growth;$i++) {
                                                
$intend .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                                            }
                                            echo 
'<option '.((isset($_SESSION["last_parent_category"]) && $_SESSION["last_parent_category"] == $row["id"]) ? 'selected' '').' value="'.$row["id"].'">'.$intend.'|__'.$row["name"].'</option>';
                                            
intendChildren($row["children"], ($growth+1));
                                        }
                                    }
                                
                                    foreach(
$ordered_categories as $row) {
                                        echo 
'<option '.((isset($_SESSION["last_parent_category"]) && $_SESSION["last_parent_category"] == $row["id"]) ? 'selected' '').' value="'.$row["id"].'">|__'.$row["name"].'</option>';
                                        
intendChildren($row["children"], 1);
                                    } 
Intend betyder "avse"...
...medan ...
Indent betyder "indrag"...
Conny Westh är inte uppkopplad   Svara med citatSvara med citat