D&C GLug - Home Page

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

Re: [LUG] PHP Error, Help!?

 

I'll give that a try, thanks :D

Jon

On 15/05/07, Peter Walker <peter.walker@xxxxxxxxxxxxxxx> wrote:
> Jonathan Roberts wrote:
> > Hmm, I'm starting to feel a bit suspicious of this whole thing now: I
> > added "echo $GLOBALS['registered_sidebars'];" with no effect. Lol, and
> > I'm sure I uploaded the new version correctly...
> >
> That probably means it isn't set. From the rest of the code I guess that
> it should be an array itself.
> How about
>
>     case 4:
>         if (count($GLOBALS['registered_sidebars']) > 0) {
>                 $sidebar_args = end($GLOBALS['registered_sidebars']);
>         }
>
>     $output .= $sidebar_args['before_title'] . TXT_WPSC_SHOPPINGCART."
> $fancy_collapser" . $sidebar_args['after_title'];
>     break;
>
> Might need a bit of tidying, I haven't used PHP in a while. Also look at 
> is_array().
>
> Pete
>
>
> > If anyone's interested in seeing the error in the wild:
> >
> > http://handmaidkitsch.co.uk
> >
> > Goto the shop and just add something to the cart and you'll see it in
> > the sidebar. The weird thing is everything works fine, it just looks
> > *ugly*, even if I could just hide the error that would be cool :D
> >
> > Jon
> >
> > On 14/05/07, Martijn <sweetwatergeek@xxxxxxxxxxxxxx> wrote:
> >
> >>>     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
> >>
> >>
> >
> >
>
>
> --
> 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
>

-- 
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