Simple Machines Community Forum

Customizing SMF => Graphics and Templates => Topic started by: Devicon on August 15, 2012, 10:24:25 PM

Title: Centering Menu Bar.
Post by: Devicon on August 15, 2012, 10:24:25 PM
I have tried a few modifications, they didn't work. I'm looking to center my menu bar.

I'm using the theme Estalia.

Here is what i believe to by my menu code.

function template_body_above()
{
   global $context, $settings, $options, $scripturl, $txt, $modSettings;

   echo '
   <div id="body-top">
      <div id="top-banner">     
      </div>
   </div>
   
      ',template_menu(),'
   <div id="mainbody">
      <div class="clr"/></div>
      <div class="wrapper">';
         
     
   theme_linktree2(false,'white');
   
   //SMFPacks Shoutbox -->
   if (function_exists('template_shoutbox')) template_shoutbox('main');
   // <-- SMFPacks Shoutbox
Title: Re: Centering Menu Bar.
Post by: Deaks on August 16, 2012, 10:41:59 AM
template_menu()


Look for this again at bottom of the index.template.php and post the code please, if there is any css classes or id's in it please also post them.
Thanks
Title: Re: Centering Menu Bar.
Post by: Devicon on August 16, 2012, 11:04:59 AM
Quote from: Poύνικ on August 16, 2012, 10:41:59 AM
template_menu()


Look for this again at bottom of the index.template.php and post the code please, if there is any css classes or id's in it please also post them.
Thanks

That was in the code i posted.

Quote',template_menu(),'
   <div id="mainbody">
      <div class="clr"/></div>
      <div class="wrapper">';
Title: Re: Centering Menu Bar.
Post by: Sir Osis of Liver on August 16, 2012, 03:17:41 PM


If anyone can do this in index.css, I'd like to see it.  Can float right or left, and set fixed margins, but cannot center it (margin: auto doesn't work). >:(

Here's a crappy inline hack you can use -

In index.template.php:



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


echo'
<div id="navigation">
<div class="wrapper" align="center">
<div style="display: inline-block;">
<ul>';

foreach ($context['menu_buttons'] as $act => $button)
echo '<li><a href="', $button['href'], '">', $button['title'], '</a></li>';

echo'
</ul>
</div></div></div>';
}



Yeah, I know it's deprecated, but it werks gud. (http://www.thekrashsite.com/pics/thu.gif)

Title: Re: Centering Menu Bar.
Post by: Devicon on August 16, 2012, 03:49:19 PM
Thanks man, it worked great.

Title: Re: Centering Menu Bar.
Post by: Jeremy M. on April 17, 2013, 02:54:39 PM
Quote from: Krash. on August 16, 2012, 03:17:41 PM


If anyone can do this in index.css, I'd like to see it.  Can float right or left, and set fixed margins, but cannot center it (margin: auto doesn't work). >:(

Here's a crappy inline hack you can use -

In index.template.php:



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


echo'
<div id="navigation">
<div class="wrapper" align="center">
<div style="display: inline-block;">
<ul>';

foreach ($context['menu_buttons'] as $act => $button)
echo '<li><a href="', $button['href'], '">', $button['title'], '</a></li>';

echo'
</ul>
</div></div></div>';
}



Yeah, I know it's deprecated, but it werks gud. (http://www.thekrashsite.com/pics/thu.gif)

doesn't work for me. I have 2.0.4
Title: Re: Centering Menu Bar.
Post by: Sir Osis of Liver on April 17, 2013, 10:52:10 PM

Attach your index.template.php and I'll have a look.