[support] Problem getting a custom menu to display (D7)

Eric Chen eric.chenchao at gmail.com
Fri Oct 26 05:52:31 UTC 2012


The path generated will be like productmenu/products/Color+MFP.

It turns out "+" does not work in Drupal menu router function.

Change urlencode() and make links look like productmenu/products/Color_MFP
will fix the issue

Cheers, Eric

On Fri, Oct 26, 2012 at 3:17 PM, Ken Robinson <kenrbnsn at rbnsn.com> wrote:

> Thanks. I tried that and it didn't work for me. :-(
>
> I thought that maybe the superfish module that I'm using to display
> the menu was interfering, but turning it off didn't help. Any other
> suggestions?
>
> Ken
>
> At 05:54 PM 10/25/2012, Metzler, David wrote:
> >Problem is the titles in the child elements.   Try this:
> >
> >         $items["productmenu/products/" .urlencode($cat)] = array(
> >                                         'title' => $cat,
> >                                         'page callback' =>
> > '_productmenu_menu_page',
> >                                         'page arguments' =>
> > array(url("$base_url/productscategory/$id")),
> >                                         'access callback' => TRUE,
> >                                         'expanded' => TRUE,
> >                                 );
> >That worked for me.
> >
> >-----Original Message-----
> >From: support-bounces at drupal.org [mailto:support-bounces at drupal.org]
> >On Behalf Of Ken Robinson
> >Sent: Thursday, October 25, 2012 2:00 PM
> >To: support at drupal.org
> >Subject: Re: [support] Problem getting a custom menu to display (D7)
> >
> >Thanks. According to the comments in the menu example I'm following, if
> you
> >don't have a 'type', it defaults to MENU_NORMAL_ITEM. If I type the
> >generated
> >URL directly, I get the expected results -- it goes to the correct place,
> >not a 404.
> >
> >Ken
> >
> > > -----Original Message-----
> > > From: support-bounces at drupal.org [mailto:support-bounces at drupal.org]
> On
> > > Behalf Of Metzler, David
> > > Sent: Thursday, October 25, 2012 4:52 PM
> > > To: 'support at drupal.org'
> > > Subject: Re: [support] Problem getting a custom menu to display (D7)
> > >
> > > Looks like you're missing the 'type' on your second items array (the
> > > one in  your foreach loop. You also might consider properly url
> > > econding the menu rather than using the str_replace() function.
> > >
> > > Also can you verify what happens if you visit the URL directly?  Do you
> > > get the page or a page not found?
> > >
> > > Dave
> > >
> > > -----Original Message-----
> > > From: support-bounces at drupal.org [mailto:support-bounces at drupal.org]
> On
> > > Behalf Of Ken Robinson
> > > Sent: Thursday, October 25, 2012 1:29 PM
> > > To: support at drupal.org
> > > Subject: [support] Problem getting a custom menu to display (D7)
> > >
> > > I have written a menu using a custom module. I can't get it to
> > > display on my test site. I used the menu example in the examples
> > > module as a guideline.
> > >
> > > My code can be seen at http://pastebin.com/VJiC5anM
> > >
> > > I've enabled the module and I know it's being executed, since I see
> > > the output of the dpm($items) call. I clear the cache every time I
> > > make a change to the code. Any help would be appreciated.
> > >
> > > Thanks in advance.
> > >
> > > Ken
> > >
> > > --
> > > [ Drupal support list | http://lists.drupal.org/ ]
> > > --
> > > [ Drupal support list | http://lists.drupal.org/ ]
> >
> >--
> >[ Drupal support list | http://lists.drupal.org/ ]
> >--
> >[ Drupal support list | http://lists.drupal.org/ ]
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20121026/839c8469/attachment-0001.html 


More information about the support mailing list