D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] PHP Error, Help!?

 

>     case 4:
>     $sidebar_args = end($GLOBALS['registered_sidebars']);
>     $output .= $sidebar_args['before_title'] . TXT_WPSC_SHOPPINGCART."
> $fancy_collapser" . $sidebar_args['after_title'];
>     break;

It's hard to tell without seeing the full website code, but the error
does suggest that the variable $GLOBALS['registered_sidebars'] is not
an array, i.e. not an (indexed or non-indexed) list of variables. It
might be that it has a single value (e.g. 'Hello world'), but it
probably is just empty/undefined.

end() is a function that returns the last element of an array, e.g. the script

$counties = ['Somerset','Dorset','Devon','Cornwall'];
echo end($counties);

prints

Cornwall

It would be interesting to see what the value of
$GLOBALS['registered_sidebars'] is. You could find out by inserting a
line
echo $GLOBALS['registered_sidebars'];
right before (or after) the $sidebar_args line. Just like David, I
would guess that it should be $_GLOBALS, but if that doesn't help...

Martijn.

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html