Simple Machines Community Forum

General Community => Scripting Help => Topic started by: mysimplesite on July 04, 2017, 11:52:57 PM

Title: Addtional menu item code blanks screen
Post by: mysimplesite on July 04, 2017, 11:52:57 PM
2.0.14, php7.1, ShelfLife theme

In 2.0.14 Sources folder found Subs.php and found section for menus. Haven't done coding for 40 plus years so copied some suggestions from Documentation but obviously have messed something up.

All I want to do is add a menu link from SMF to my other site.

Added this code, which blanks screen. Code starts at line 4145.

// Add menu link for my site .
         ).
         'mysimplemess' => array (   
         'title' => $txt['My Simple Mess'],
            'href' => 'https://blahblahblah.com/',
            'show' => true,
            'sub_buttons' => array(
             ),
            'is_last' => !$context['right_to_left'],
      // End menu link addtion


I added that code before the
),
         'logout' => array(
            'title' => $txt['logout'],
            'href' => $scripturl . '?action=logout;%1$s=%2$s',
            'show' => !$user_info['is_guest'],
            'sub_buttons' => array(
            ),
            'is_last' => !$context['right_to_left'],
         ),
      );


Thanks in advance.
Title: Re: Addtional menu item code blanks screen
Post by: Gwenwyfar on July 05, 2017, 12:49:42 AM
Where you added "'title' => $txt['My Simple Mess'], ", have you actually defined an existing variable there? If you're trying to use a variable that doesn't exist it can give you problems.

Also if you left a dot on the first line of your code, that could give a syntax error. Try a comma there.

// Add menu link for my site .
         ).
Title: Re: Addtional menu item code blanks screen
Post by: mysimplesite on July 05, 2017, 01:03:33 AM
You hit the nail on the head, Gwenwyfar. I didn't define a variable. Sheesh. I'm getting too old for this. Fixed the dot issue too.

Thanks. Consider this solved.
Title: Re: Addtional menu item code blanks screen
Post by: vjulian on July 06, 2017, 08:50:17 AM
Wow believe me i was facing similar problem today and just came across this thread. It solved my problem like a charm. I mean what are the odds. :o