I have some code that works brilliantly on my local server, but behaves totally differently on the live server. Heres a bit of the code:
Code: Select all
$categories_data = $categories->get_cats();
$categories_html = '';
function generate_list($parent){
$has_childs = false;
global $categories;
global $categories_data;
global $categories_html;
global $html_website_path;
foreach($categories_data as $key => $value){
if ($value['parent_id'] == $parent) {
if ($has_childs == false){
$has_childs = true;
$categories_html .= '
<ul>
';
}
$categories_html .= '<li>'.htmlentities($value['category_title']);
// THIS IS MY LITTLE BIT OF DEBUG DATA
echo $value['parent_id'].' - '.$key.' ('.$parent.')<br />';
generate_list($key);
$categories_html .= '</li>
';
}
}
if ($has_childs === true) {
$categories_html .= '
</ul>
';
}
return $categories_html;
}Code: Select all
0 - 38 (0)
38 - 39 (38)
39 - 40 (39)
39 - 41 (39)
39 - 42 (39)
39 - 43 (39)
39 - 44 (39)
39 - 45 (39)
39 - 46 (39)
39 - 47 (39)
39 - 48 (39)
0 - 49 (0)
49 - 50 (49)
50 - 51 (50)
50 - 52 (50)
50 - 53 (50)
50 - 54 (50)
54 - 55 (54)
50 - 56 (50)
50 - 57 (50)
50 - 58 (50)
49 - 59 (49)
59 - 60 (59)
59 - 61 (59)
...Code: Select all
0 - 38 (0)
0 - 38 (38)
38 - 39 (38)
0 - 38 (39)
38 - 39 (39)
39 - 40 (39)
0 - 38 (40)
38 - 39 (40)
39 - 40 (40)
39 - 41 (40)
39 - 42 (40)
39 - 43 (40)
39 - 44 (40)
39 - 45 (40)
39 - 46 (40)
39 - 47 (40)
39 - 48 (40)
0 - 49 (40)
...