$current_page_base is not an array but a variable holding a string. It doesn't have the full address, only the value of main_page= from the URL. In a category page, $cPath will hold the value of cPath=. You would do a two-stage test, like
if ($current_page_base == 'index' and $cPath == '18_56')
Rather than duplicate the whole assignment statement for the current or not-current state, I would use a variable to assign a class tag where appropriate.
Rearrange the test and assignment using a "ternary operator" to make it compact:
if a is true? then do b: otherwise do c;
$current_class = ($current_page_base == 'index' and $cPath == '18_56')? ' class="current"': '';
Then insert the variable which will be blank unless the cPath matches the current page. Put it right in the <a> for conciseness:
$define_sidebox_ref[] = '<a href="index.php?main_page=index&cPath=18_56"' . $current_class . '>2011 Code Books & Tabs</a>';
PHP Code:
$current_class = ($current_page_base == 'index' and $cPath == '18_56')? ' class="current"': '';
$define_sidebox_ref[] = '<a href="index.php?main_page=index&cPath=18_56"' . $current_class . '>2011 Code Books & Tabs</a>';
Or compact it even more:
PHP Code:
$define_sidebox_ref[] = '<a href="index.php?main_page=index&cPath=18_56"' . (($current_page_base == 'index' and $cPath == '18_56')? ' class="current"': '') . '>2011 Code Books & Tabs</a>';
$define_sidebox_ref[] = '<a href="index.php?main_page=index&cPath=18_57"' . (($current_page_base == 'index' and $cPath == '18_57')? ' class="current"': '') . '>Solar Photovoltaic Sys.</a>';
$define_sidebox_ref[] = '<a href="index.php?main_page=index&cPath=18_58"' . (($current_page_base == 'index' and $cPath == '18_58')? ' class="current"': '') . '>NEC Code Changes Books</a>';
Bookmarks