TinyPortal

General => Chit chat => Topic started by: Paulie on December 13, 2005, 02:03:18 PM

Title: Joining up menu buttons
Post by: Paulie on December 13, 2005, 02:03:18 PM
Hi peeps :)

Can anyone code savvy person tell me where the snippet of code is, so i can join up (no spaces) my top munu buttons please.
Title: Re: Joining up menu buttons
Post by: IchBin on December 13, 2005, 02:29:20 PM
Most themes have the template_menu function located at the bottom. You'll find all the links there. Sometimes they have styles applied to them from the style.css file too.
Title: Re: Joining up menu buttons
Post by: Paulie on December 13, 2005, 02:52:43 PM
Is it just a case of spacing/padding then?
Title: Re: Joining up menu buttons
Post by: IchBin on December 13, 2005, 03:25:26 PM
Depends on the theme. But yes, it's mostly just how its padding and margins are set.
Title: Re: Joining up menu buttons
Post by: Paulie on December 13, 2005, 04:31:41 PM
Just a varient of the default. But for some reason i can`t get the gaps closed :(
Title: Re: Joining up menu buttons
Post by: IchBin on December 13, 2005, 10:34:09 PM
Change the template_menu function at the bottom of the index.template.php file to this:
// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
        global $context, $settings, $options, $scripturl, $txt;

     // Show the [home] and [help] buttons.
       echo '
                  <a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0px;" border="0" />' : $txt[103]), '</a>';
       echo '<a href="', $scripturl, '?action=forum">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/forum.gif" alt="Forum Index" style="margin: 2px 0px;" border="0" />' : 'Forum Index'), '</a>';
       echo '<a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0px;" border="0" />' : $txt[119]), '</a>';

        // How about the [search] button?
        if ($context['allow_search'])
                echo '<a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" style="margin: 2px 0;" border="0" />' : $txt[182]), '</a>';

      // Is the user allowed to administrate at all? ([admin])
        if ($context['allow_admin']){
                echo '<a href="', $scripturl, '?action=admin">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin.gif" alt="' . $txt[2] . '" style="margin: 2px 0;" border="0" />' : $txt[2]), '</a>';
                echo '<a href="', $scripturl, '?action=tpadmin">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/tpadmin.gif" alt="Tiny Portal Admin" style="margin: 2px 0;" border="0" />' : 'TPadmin'), '</a>';

        }

        // Edit Profile... [profile]
        if ($context['allow_edit_profile'])
                echo '<a href="', $scripturl, '?action=profile">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile.gif" alt="' . $txt[79] . '" style="margin: 2px 0;" border="0" />' : $txt[467]), '</a>';

        // The [calendar]!
        if ($context['allow_calendar'])
                echo '<a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 2px 0;" border="0" />' : $txt['calendar24']), '</a>';

        // If the user is a guest, show [login] and [register] buttons.
        if ($context['user']['is_guest'])
        {
                echo '<a href="', $scripturl, '?action=login">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/login.gif" alt="' . $txt[34] . '" style="margin: 2px 0;" border="0" />' : $txt[34]), '</a>
                     <a href="', $scripturl, '?action=register">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/register.gif" alt="' . $txt[97] . '" style="margin: 2px 0;" border="0" />' : $txt[97]), '</a>';
        }
        // Otherwise, they might want to [logout]...
        else
                echo '<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';
}
Title: Re: Joining up menu buttons
Post by: Paulie on December 13, 2005, 10:45:29 PM
Just tried and got this:


Template Parse Error!
There was a problem loading the /Themes/test-theme/index.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.
Title: Re: Joining up menu buttons
Post by: IchBin on December 13, 2005, 10:49:28 PM
It works fine for me.
Mind posting your index.template file? or email me.
Title: Re: Joining up menu buttons
Post by: Paulie on December 13, 2005, 10:52:34 PM
No worries. Here ya go: I just copied and pasted.


     // Show the [home] and [help] buttons.
       echo '
                  <a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0px;" border="0" />' : $txt[103]), '</a>';
       echo '<a href="', $scripturl, '?action=forum">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/forum.gif" alt="Forum Index" style="margin: 2px 0px;" border="0" />' : 'Forum Index'), '</a>';
       echo '<a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0px;" border="0" />' : $txt[119]), '</a>';

        // How about the [search] button?
        if ($context['allow_search'])
                echo '<a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" style="margin: 2px 0;" border="0" />' : $txt[182]), '</a>';

      // Is the user allowed to administrate at all? ([admin])
        if ($context['allow_admin']){
                echo '<a href="', $scripturl, '?action=admin">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin.gif" alt="' . $txt[2] . '" style="margin: 2px 0;" border="0" />' : $txt[2]), '</a>';
                echo '<a href="', $scripturl, '?action=tpadmin">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/tpadmin.gif" alt="Tiny Portal Admin" style="margin: 2px 0;" border="0" />' : 'TPadmin'), '</a>';

        }

        // Edit Profile... [profile]
        if ($context['allow_edit_profile'])
                echo '<a href="', $scripturl, '?action=profile">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile.gif" alt="' . $txt[79] . '" style="margin: 2px 0;" border="0" />' : $txt[467]), '</a>';

        // The [calendar]!
        if ($context['allow_calendar'])
                echo '<a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 2px 0;" border="0" />' : $txt['calendar24']), '</a>';

        // If the user is a guest, show [login] and [register] buttons.
        if ($context['user']['is_guest'])
        {
                echo '<a href="', $scripturl, '?action=login">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/login.gif" alt="' . $txt[34] . '" style="margin: 2px 0;" border="0" />' : $txt[34]), '</a>
                     <a href="', $scripturl, '?action=register">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/register.gif" alt="' . $txt[97] . '" style="margin: 2px 0;" border="0" />' : $txt[97]), '</a>';
        }
        // Otherwise, they might want to [logout]...
        else
                echo '<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';
}

?>
Title: Re: Joining up menu buttons
Post by: IchBin on December 13, 2005, 10:55:37 PM
You have this section above the code you posted?
// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
        global $context, $settings, $options, $scripturl, $txt;
Title: Re: Joining up menu buttons
Post by: Paulie on December 13, 2005, 10:57:41 PM
Yeah, sorry lol forgot that bit.

// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
   global $context, $settings, $options, $scripturl, $txt;
// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
        global $context, $settings, $options, $scripturl, $txt;

     // Show the [home] and [help] buttons.
       echo '
                  <a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0px;" border="0" />' : $txt[103]), '</a>';
       echo '<a href="', $scripturl, '?action=forum">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/forum.gif" alt="Forum Index" style="margin: 2px 0px;" border="0" />' : 'Forum Index'), '</a>';
       echo '<a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0px;" border="0" />' : $txt[119]), '</a>';

        // How about the [search] button?
        if ($context['allow_search'])
                echo '<a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" style="margin: 2px 0;" border="0" />' : $txt[182]), '</a>';

      // Is the user allowed to administrate at all? ([admin])
        if ($context['allow_admin']){
                echo '<a href="', $scripturl, '?action=admin">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin.gif" alt="' . $txt[2] . '" style="margin: 2px 0;" border="0" />' : $txt[2]), '</a>';
                echo '<a href="', $scripturl, '?action=tpadmin">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/tpadmin.gif" alt="Tiny Portal Admin" style="margin: 2px 0;" border="0" />' : 'TPadmin'), '</a>';

        }

        // Edit Profile... [profile]
        if ($context['allow_edit_profile'])
                echo '<a href="', $scripturl, '?action=profile">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile.gif" alt="' . $txt[79] . '" style="margin: 2px 0;" border="0" />' : $txt[467]), '</a>';

        // The [calendar]!
        if ($context['allow_calendar'])
                echo '<a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 2px 0;" border="0" />' : $txt['calendar24']), '</a>';

        // If the user is a guest, show [login] and [register] buttons.
        if ($context['user']['is_guest'])
        {
                echo '<a href="', $scripturl, '?action=login">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/login.gif" alt="' . $txt[34] . '" style="margin: 2px 0;" border="0" />' : $txt[34]), '</a>
                     <a href="', $scripturl, '?action=register">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/register.gif" alt="' . $txt[97] . '" style="margin: 2px 0;" border="0" />' : $txt[97]), '</a>';
        }
        // Otherwise, they might want to [logout]...
        else
                echo '<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';
}

?
Title: Re: Joining up menu buttons
Post by: Paulie on December 13, 2005, 11:01:39 PM
Got it. I had a double up on the top lines. Thanks IchBin ;)
Title: Re: Joining up menu buttons
Post by: IchBin on December 13, 2005, 11:03:32 PM
Lmao! I was just typing what your error was. :)
Title: Re: Joining up menu buttons
Post by: Paulie on December 13, 2005, 11:04:58 PM
Lol, that`s me all over. Still if ya don`t try these things eh ;)
Title: Re: Joining up menu buttons
Post by: Paulie on December 13, 2005, 11:17:57 PM
I know i`ll have to redo the buttons , but i like it.