TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,964
  • Latest: stylix
Stats
  • Total Posts: 195,935
  • Total Topics: 21,311
  • Online today: 1,319
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 488
  • Total: 488

Help - Centering menu bar

Started by sooner, June 12, 2007, 10:21:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sooner

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

Crip

in some you can do like:

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


then some menus in diff. ways
I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



Crip

I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



sooner

just not having any luck. Anytime I put that table code in i get parsing errors.

sooner

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..

IchBin

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?

Crip

it works like this:


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


then close it all at the end:
</a>';</center>
I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



sooner

I still got parsing errors when inserting the center tag

IchBin


sooner

surely i can figure this out with that link. Thx will give it a go.

IchBin

You need help just let us know. :) Good to see you give a shot. Good luck!

sooner

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.

sooner

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..

sooner

I also found template_menu   

tried putting table tags around that, but it all it does it shift things around..

sooner

well, i will try some more tomorrow... at least I have learned all about echo  hehe

tick

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;">

IchBin

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.

sooner

Tick:  I searched for that code, but it did not find it in the index.template.php file.

Crip

Tick,
It's Babylon Theme, meaning it's different than smf Default..
I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



sooner


Crip

did you try it like i showed you?
I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



Crip

If you wanna give me a Temp. Admin account I can do it for you ??

....PM info
I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



sooner

I did it!  w00t!

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


and

</a></center>';


sooner

Thx for all the help! This VB d00d learned alot!

sooner

now if I can turn off or get rid of those to little "callapse header" buttons, i am set.

G6Cad

Do a search and you will find out how to remove them.

sooner


Crip

U got old Babylon looking great.. good work there sooner :up:
I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



tick

My bad.  I did not pick up on that.  Sorry .  ;D

This website is proudly hosted on Crocweb Cloud Website Hosting.