TinyPortal

Development => Feedback => Topic started by: sooner on June 12, 2007, 10:21:11 PM

Title: Help - Centering menu bar
Post by: sooner on June 12, 2007, 10:21:11 PM
Ok, I have been searching thru the index templates but I just can;t seem to find a way to center the menu bar.

The bar that has home/forum/help/profile and such buttons on it..

Currently it is aligned to the left, under my banner, but i'd like to center it.

Any ideas?

you can see it here

www.gotreasurelake.com

TIA
Title: Re: Help - Centering menu bar
Post by: Crip on June 12, 2007, 10:31:24 PM
in some you can do like:

<table align="center" cellpadding="0" cellspacing="0" width="100%">


then some menus in diff. ways
Title: Re: Help - Centering menu bar
Post by: Crip on June 12, 2007, 10:38:58 PM
Babylon:
http://www.cripcan.com/portal/index.php?theme=3
Title: Re: Help - Centering menu bar
Post by: sooner on June 13, 2007, 12:20:11 AM
just not having any luck. Anytime I put that table code in i get parsing errors.
Title: Re: Help - Centering menu bar
Post by: sooner on June 13, 2007, 12:25:33 AM
I am assuming this is the code that generates the menu bar

// 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 0;" border="0" />' : $txt[103]), '</a>', $context['menu_separator'];
if($settings['TPortal_front_type']!='boardindex')

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 0;" border="0" />' : 'Forum Index'), '</a>', $context['menu_separator'];

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 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];

// 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>', $context['menu_separator'];

// 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>', $context['menu_separator'];

// 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>', $context['menu_separator'];

// 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>', $context['menu_separator'];

// 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>', $context['menu_separator'], '
<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>';
}

// Generate a strip of buttons, out of buttons.
function template_button_strip($button_strip, $direction = 'top', $force_reset = false, $custom_td = '')
{
global $settings, $buttons, $context, $txt, $scripturl;

if (empty($button_strip))
return '';

// Create the buttons...
foreach ($button_strip as $key => $value)
{
if (isset($value['test']) && empty($context[$value['test']]))
{
unset($button_strip[$key]);
continue;
}
elseif (!isset($buttons[$key]) || $force_reset)
$buttons[$key] = '<a href="' . $value['url'] . '" ' .( isset($value['custom']) ? $value['custom'] : '') . '>' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . ($value['lang'] ? $context['user']['language'] . '/' : '') . $value['image'] . '" alt="' . $txt[$value['text']] . '" border="0" />' : $txt[$value['text']]) . '</a>';

$button_strip[$key] = $buttons[$key];
}

echo '
        <td ', $custom_td, '>', implode($context['menu_separator'], $button_strip) , '</td>';
}



I've tried the table thing, even tried to add attributes to the td tags as well, but it either doesn't work or i get parsing errors..
Title: Re: Help - Centering menu bar
Post by: IchBin on June 13, 2007, 12:34:32 AM
Not having access to files while I'm at school, can you post the actual code where the template_menu is called and not the actual function?
Title: Re: Help - Centering menu bar
Post by: Crip on June 13, 2007, 12:40:14 AM
it works like this:


// Show the [home] and [help] buttons.
echo '<center>


then close it all at the end:
</a>';</center>
Title: Re: Help - Centering menu bar
Post by: sooner on June 13, 2007, 12:48:16 AM
I still got parsing errors when inserting the center tag
Title: Re: Help - Centering menu bar
Post by: IchBin on June 13, 2007, 12:50:31 AM
Perhaps you guys should read my php echo tutorial. :D
http://www.ichbin.us/index.php?topic=19.msg36;topicseen#new
Title: Re: Help - Centering menu bar
Post by: sooner on June 13, 2007, 12:59:31 AM
surely i can figure this out with that link. Thx will give it a go.
Title: Re: Help - Centering menu bar
Post by: IchBin on June 13, 2007, 01:05:01 AM
You need help just let us know. :) Good to see you give a shot. Good luck!
Title: Re: Help - Centering menu bar
Post by: sooner on June 13, 2007, 02:49:20 AM
Well, tried it and tho I did the echo stuff right, it was making tables under the menu bar..lol

I am guessing I am not editing the correct spot.

// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{



Does that go into another file just for the menu? If so, I havnt found it.
Title: Re: Help - Centering menu bar
Post by: sooner on June 13, 2007, 02:50:36 AM
Then this is underneath it

// 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 0;" border="0" />' : $txt[103]), '</a>', $context['menu_separator'];
if($settings['TPortal_front_type']!='boardindex')

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 0;" border="0" />' : 'Forum Index'), '</a>', $context['menu_separator'];

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 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];

// 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>', $context['menu_separator'];

// 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>', $context['menu_separator'];

// 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>', $context['menu_separator'];

// 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>', $context['menu_separator'];

// 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>', $context['menu_separator'], '
<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>';
}


That to me looks like the code that makes the menu bar, correct?  I tried to echo the table center around that, but it didnt work, it was making a table under it..
Title: Re: Help - Centering menu bar
Post by: sooner on June 13, 2007, 03:11:22 AM
I also found template_menu   

tried putting table tags around that, but it all it does it shift things around..
Title: Re: Help - Centering menu bar
Post by: sooner on June 13, 2007, 03:21:41 AM
well, i will try some more tomorrow... at least I have learned all about echo  hehe
Title: Re: Help - Centering menu bar
Post by: tick on June 13, 2007, 03:45:03 AM
Find

// Show the start of the tab section.
echo '
<table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;">



And replace with

// Show the start of the tab section.
echo '
<table align="center" cellpadding="0" cellspacing="0" border="0" style="margin-center: 10px;">
Title: Re: Help - Centering menu bar
Post by: IchBin on June 13, 2007, 04:47:12 AM
You'll notice towards the top of the index.template file a place where the actual menu is called. Not the function code that you posted. Edit the table that its already sitting in.
Title: Re: Help - Centering menu bar
Post by: sooner on June 13, 2007, 03:26:33 PM
Tick:  I searched for that code, but it did not find it in the index.template.php file.
Title: Re: Help - Centering menu bar
Post by: Crip on June 13, 2007, 03:34:31 PM
Tick,
It's Babylon Theme, meaning it's different than smf Default..
Title: Re: Help - Centering menu bar
Post by: sooner on June 13, 2007, 03:47:42 PM
right, babylon.

Title: Re: Help - Centering menu bar
Post by: Crip on June 13, 2007, 04:08:22 PM
did you try it like i showed you?
Title: Re: Help - Centering menu bar
Post by: Crip on June 13, 2007, 04:10:37 PM
If you wanna give me a Temp. Admin account I can do it for you ??

....PM info
Title: Re: Help - Centering menu bar
Post by: sooner on June 13, 2007, 04:20:17 PM
I did it!  w00t!

// Show the [home] and [help] buttons.
echo '<center>';


and

</a></center>';

Title: Re: Help - Centering menu bar
Post by: sooner on June 13, 2007, 04:21:31 PM
Thx for all the help! This VB d00d learned alot!
Title: Re: Help - Centering menu bar
Post by: sooner on June 13, 2007, 04:23:04 PM
now if I can turn off or get rid of those to little "callapse header" buttons, i am set.
Title: Re: Help - Centering menu bar
Post by: G6Cad on June 13, 2007, 04:26:42 PM
Do a search and you will find out how to remove them.
Title: Re: Help - Centering menu bar
Post by: sooner on June 13, 2007, 04:58:58 PM
Yep, found it, many thx!
Title: Re: Help - Centering menu bar
Post by: Crip on June 13, 2007, 05:46:10 PM
U got old Babylon looking great.. good work there sooner :up:
Title: Re: Help - Centering menu bar
Post by: tick on June 13, 2007, 08:08:10 PM
My bad.  I did not pick up on that.  Sorry .  ;D