Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 06:15 am EST

Geeklog Forums

custom menu entries: Parse error


Jack

Anonymous
confused
Hi all

Bit of a newb to PHP, so this may be missing somthing obvious.

I'm trying to add custom menu entries, but if I uncomment 'custom' in config.php I just get a parse error:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting 'Wink' in /home/fhlinux209/s/staumc.co.uk/user/config.php on line 210

the appropriate section of config.php is

PHP Formatted Code

$_CONF['menu_elements'] = array
(
    'home',         // link to homepage
    //'contribute',   // contribute  "submit a story" link
    //'plugins',      // links added by plugins, like {plg_menu_elements}
    'custom'        // for custom links (see lib-custom.php)
    'calendar',     // link to the site calendar
    'search',       // link to advanced search
    'prefs',        // link to user's preferences

);
 

(line 210 is 'calendar'Wink

This appears to happen irrespective of what I have in system/lib-custom.php

I started with:

PHP Formatted Code

function CUSTOM_menuEntries ()
{
    global $_CONF, $_USER;

    $myentries[] = array ('url'   => $_CONF['site_url'] . '/mediagallery/index.php',
                          'label' => 'Gallery');
    $myentries[] = array ('url'   => $_CONF['site_url'] . '/forum/index.php/forum=1',
                          'label' => 'Forum');
    $myentries[] = array ('url'   => $_CONF['site_url'] . '/staticpages/index.php/IntrotoClub',
                          'label' => 'About Us');
    $myentries[] = array ('url'   => $_CONF['site_url'] . '/staticpages/index.php/Meets',
                          'label' => 'Meets');
    $myentries[] = array ('url'   => $_CONF['site_url'] . '/staticpages/index.php/KitList',
                          'label' => 'Kit List');
    $myentries[] = array ('url'   => $_CONF['site_url'] . '/staticpages/index.php/Socials',
                          'label' => 'Socials');
    $myentries[] = array ('url'   => $_CONF['site_url'] . '/staticpages/index.php/commitee',
                          'label' => 'Commitee');
    $myentries[] = array ('url'   => $_CONF['site_url'] . '/staticpages/index.php/docs',
                          'label' => 'Documents');
    $myentries[] = array ('url'   => $_CONF['site_url'] . '/links/',
                          'label' => 'Links');

    return $myentries;
}
 


I think that's the right syntax, though there were no explicit examples of how to do multiple entries, so in case I'd got it wrong I commented out most of them:

PHP Formatted Code

function CUSTOM_menuEntries ()
{
    global $_CONF, $_USER;

    $myentries[] = array ('url'   => $_CONF['site_url'] . '/mediagallery/index.php',
                          'label' => 'Gallery');
/*  
       [snip]
*/

    return $myentries;
}
 


still no luck.

any help much appreciated.

Jack

PS. Geeklog version 1.4.1
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
There has to be a comma after 'custom'

bye, Dirk
 Quote

OP

Anonymous
embarrassed
Quote by: Jack

Bit of a newb to PHP, so this may be missing somthing obvious.



Like a comma missing from the end of the line 'custom' :doh:

As a side note, there is no comma on the line end in the stock custom.php.
This is not a problem as it is the last line in the array, but if someone without a good knowledge of php (i.e. me) reorders the entries then it causes problems. Perhaps a note to this effect could be added? or perhaps this would count as too much spoonfeeding, it is possible to have too many comments in a file after all.

Jack
 Quote

OP

Anonymous
wow! simu-posting.

Thanks Dirk, really good support on here.

Jack
 Quote

All times are EST. The time is now 06:15 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content