Quote Originally Posted by gjh42 View Post
$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&amp;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&amp;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&amp;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&amp;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&amp;cPath=18_58"' . (($current_page_base == 'index' and $cPath == '18_58')? ' class="current"''') . '>NEC Code Changes Books</a>'
Thank you so much for this! I was able to get it to work using the conditional "if" and duplicating the statements, but I could not get the other methods to work with the class within the variable!

The class assigned to the main category box is SPAN.box-body, but even created a class called .current to match your example! Still didn't work that way!

Of course it is more code, but guess I can do it with the conditional "if", as that seems to do the trick!

Is there another way that I should include class="current"': '' ? I didn't understand the value of the ":" in that statement!

You've really helped me understand this much better, so thank you very much for that! :)