Originally Posted by
carlwhat
this explains the sub-categories problem...
if you look at my previous post #11, that is exactly my guess....
in that specific script, /home/honor/public_html/includes/classes/categories_ul_generator.php around line 85, make the following changes:
PHP Code:
//from
function buildBranch($parent_id, $level, $submenu=true, $parent_link='')
{
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="nav-child unstyled'. ($level+1) . '"' : '' );
//to
function buildBranch($parent_id, $level, $submenu=true, $parent_link='')
{
$level = (int)$level + 1;
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="nav-child unstyled'. (string)($level) . '"' : '' );
made this change is here is the error log when i try to access a page with subcategories:
[17-Nov-2018 01:27:29 UTC] PHP Fatal error: Uncaught Error: Cannot use string offset as an array in /home/honor/public_html/includes/modules/responsive_sheffield_blue/category_row.php:40
Stack trace:
#0 /home/honor/public_html/includes/templates/template_default/templates/tpl_modules_category_row.php(14): require()
#1 /home/honor/public_html/includes/templates/template_default/templates/tpl_index_categories.php(73): require('/home/honor/pub...')
#2 /home/honor/public_html/includes/modules/pages/index/main_template_vars.php(241): require('/home/honor/pub...')
#3 /home/honor/public_html/includes/templates/responsive_sheffield_blue/common/tpl_main_page.php(229): require('/home/honor/pub...')
#4 /home/honor/public_html/index.php(97): require('/home/honor/pub...')
#5 {main}
thrown in /home/honor/public_html/includes/modules/responsive_sheffield_blue/category_row.php on line 40
***
Here is the resulting code in categories_ul_generator.php:
HTML Code:
function buildBranch($parent_id, $level, $submenu=true, $parent_link='')
{
$level = (int)$level + 1;
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="nav-child unstyled'. (string)($level) . '"' : '' );
// function buildBranch($parent_id, $level = 0, $submenu=true, $parent_link='')
// {
// $result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. ($level+1) . '"' : '' );
if (($this->data[$parent_id])) {
foreach($this->data[$parent_id] as $category_id => $category) {
$category_link = $parent_link . $category_id;
if (($this->data[$category_id])) {
$result .= sprintf($this->child_start_string, ($submenu==true) ? ' class="submenu"' : '');
} else {
$result .= sprintf($this->child_start_string, '');
}
$result .= str_repeat($this->spacer_string, $this->spacer_multiplier * 1) . '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $category_link) . '">';
$result .= $category['name'];
$result .= '</a>';
if (($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
$result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');
}
$result .= $this->child_end_string;
}
}
$result .= $this->parent_group_end_string;
return $result;
}
function buildTree($submenu=false)
{
return $this->buildBranch($this->root_category_id, '', $submenu);
}
}
BTW, it works fine in php 5.6 so i quickly change to 7.1 and then test and view the error log and then change back to 5.6
Bookmarks