Hiya...
wondering if you can tell me where and what code to add to center my buttons in the navbar. They are all at the left, leaving a space at the right.
I've researched, and also looked intently at my index.template.php file to find where the align is set, but not seeing anything at all.
Any help would be appreciated. Tks. :)
index.template.php
scroll down a little from the code below and you will see the code for buttons
// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
Right...i know where that is...but what I am asking is what code to I enter to center my buttons?
SMF 1.1.x or 2.0?
ah right i thought you said i want to add buttons lol
what smf version are you using? (always add this when asking for help as they have different code)
smf rc2 http://garethgillman.co.uk/wordpress/archives/17 (http://garethgillman.co.uk/wordpress/archives/17)
smf 1.1 http://garethgillman.co.uk/wordpress/archives/15 (http://garethgillman.co.uk/wordpress/archives/15)
btw thats my test blog for a smf tut site :P
Thank you for those links :D
it is smf 1.1 :)
Oh and...this is what mine says.....
// Show the start of the tab section.
echo '
<ul>';
and this is what they are suggesting at that link....
Find: In style.css of the theme
// Show the start of the tab section.
echo '
<table style="margin-left: 10px;" border="0" cellspacing="0" cellpadding="0">
Replace With:
// Show the start of the tab section.
echo '
<table border="0" cellspacing="0" cellpadding="0" align="center">
Does the <ul>;' screw up anything?
Quote from: Faevilangel on August 12, 2009, 08:22:36 PM
ah right i thought you said i want to add buttons lol
what smf version are you using? (always add this when asking for help as they have different code)
smf rc2 http://garethgillman.co.uk/wordpress/archives/17 (http://garethgillman.co.uk/wordpress/archives/17)
Wont work. That code is not in style.css. :P
Anyway there is a better way of centering list based menus that gives a perfect result regardless of the number of tabs, which means it will appear centered to both guests and logged in members and can use the full width of the page if 50% is not enough.
http://matthewjamestaylor.com/blog/beautiful-css-centered-menus-no-hacks-full-cross-browser-support
If you put that on your blog it would be cool to credit the original source. ;)
Quote from: fluffmama on August 12, 2009, 08:24:58 PM
Thank you for those links :D
it is smf 1.1 :)
Oh and...this is what mine says.....
// Show the start of the tab section.
echo '
<ul>';
and this is what they are suggesting at that link....
Find: In style.css of the theme
// Show the start of the tab section.
echo '
<table style="margin-left: 10px;" border="0" cellspacing="0" cellpadding="0">
Replace With:
// Show the start of the tab section.
echo '
<table border="0" cellspacing="0" cellpadding="0" align="center">
Does the <ul>;' screw up anything?
Ok, so you're running a custom theme with a list-based menu. You should try the method suggested in my last post.
Quote from: Antechinus on August 12, 2009, 08:29:15 PM
Quote from: Faevilangel on August 12, 2009, 08:22:36 PM
ah right i thought you said i want to add buttons lol
what smf version are you using? (always add this when asking for help as they have different code)
smf rc2 http://garethgillman.co.uk/wordpress/archives/17 (http://garethgillman.co.uk/wordpress/archives/17)
Wont work. That code is not in style.css. :P
Anyway there is a better way of centering list based menus that gives a perfect result regardless of the number of tabs, which means it will appear centered to both guests and logged in members and can use the full width of the page if 50% is not enough.
http://matthewjamestaylor.com/blog/beautiful-css-centered-menus-no-hacks-full-cross-browser-support
If you put that on your blog it would be cool to credit the original source. ;)
damn it your right, its in index.css :p
No, it is in index.template.php.
Quote from: fluffmama on August 12, 2009, 08:24:58 PM
Thank you for those links :D
it is smf 1.1 :)
Oh and...this is what mine says.....
// Show the start of the tab section.
echo '
<ul>';
and this is what they are suggesting at that link....
Find: In style.css of the theme
// Show the start of the tab section.
echo '
<table style="margin-left: 10px;" border="0" cellspacing="0" cellpadding="0">
Replace With:
// Show the start of the tab section.
echo '
<table border="0" cellspacing="0" cellpadding="0" align="center">
Does the <ul>;' screw up anything?
the code their is for the default themes, could you post your code for your menu ;)
Quote from: Antechinus on August 12, 2009, 08:32:47 PM
No, it is in index.template.php.
i haven't done much theme work for 2.0! its shows eh :P
okie dokie....here is the code from my index.template.php file right from my theme folder....sorry it's lots, but wanted you to be able to see the whole code since it doesn't look normal? *shrugs*
// Show the start of the tab section.
echo '
<ul>';
// Show the [home] button.
echo '<li', $current_action == 'home' ? ' class="chosen"' : '', '><a href="', $scripturl, '"><span>' , $txt[103] , '</span></a></li>';
// Show the [help] button.
echo '<li', $current_action == 'help' ? ' class="chosen"' : '', '><a href="', $scripturl, '?action=help"><span>' , $txt[119] , '</span></a></li>';
Ok...and here is part from the style.css file in the themes folder.....
/* The template menu */
#tab
{
width:100%;
height:51px;
background: #FFFFFF url(./images/img/bmid_028.gif);
margin:0;
border:0;
}
#tab
{
margin:0 0 0 0;
top:0;
}
#tab ul
{
margin:0;
padding:0;
list-style:none;
float:left;
i didn't explain well, could i see the part where the index.template calls the menu template e.g.
template_menu();
First you guys rock for being so patient with me....and not sure how much you need...but here's a chunk: (please let me know if it's not enough) ;)
// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;
// Work out where we currently are.
$current_action = 'home';
if (in_array($context['current_action'], array('admin', 'ban', 'boardrecount', 'cleanperms', 'detailedversion', 'dumpdb', 'featuresettings', 'featuresettings2', 'findmember', 'maintain', 'manageattachments', 'manageboards', 'managecalendar', 'managesearch', 'membergroups', 'modlog', 'news', 'optimizetables', 'packageget', 'packages', 'permissions', 'pgdownload', 'postsettings', 'regcenter', 'repairboards', 'reports', 'serversettings', 'serversettings2', 'smileys', 'viewErrorLog', 'viewmembers')))
Quote from: fluffmama on August 12, 2009, 09:07:44 PM
First you guys rock for being so patient with me....and not sure how much you need...but here's a chunk: (please let me know if it's not enough) ;)
// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;
// Work out where we currently are.
$current_action = 'home';
if (in_array($context['current_action'], array('admin', 'ban', 'boardrecount', 'cleanperms', 'detailedversion', 'dumpdb', 'featuresettings', 'featuresettings2', 'findmember', 'maintain', 'manageattachments', 'manageboards', 'managecalendar', 'managesearch', 'membergroups', 'modlog', 'news', 'optimizetables', 'packageget', 'packages', 'permissions', 'pgdownload', 'postsettings', 'regcenter', 'repairboards', 'reports', 'serversettings', 'serversettings2', 'smileys', 'viewErrorLog', 'viewmembers')))
okay i will try again :P i need the code from the index that calls the function
could you post all of your index.template and i will find the code
KK sorry...i'm a big dummy when it comes to this stuff. O:)
Please do not post php templates as .txt files. It's a nuisance for testing because it means they have to be re-saved as php for easier checking of syntax. It also means that you can't just upload them to a live site for testing.
Best way to do it is to download the file via ftp so it stays as a php file with the correct name. Much less messing around.;)
in the #tab of the css change margin:0 0 0 0; to margin:auto; and add width:50%;
so it should be
#tab {
margin:auto;
width:50%;
top:0;
Should be margin: 0 auto; to keep the zero margin top and bottom.
Sorry, it didn't work :( it bunched everything in the center and gave me two lines of the navbar :(
any other ideas?
Use the method I suggested earlier. A 50% width div is not flexible enough to accommodate varying numbers of tabs (as in logged in or logged out) on varying screen resolutions. It's a basic, beginner's trick that works well with a small and fixed number of tabs.
Thank you so much. I'm gonna mess with it tomorrow. It's quite a bit I have to mess around with and make sure its right.
I'll let ya's know if it works for sure ;) or of course, continue whining lol.
Thanks guys for your help...will post soon!!! :D
Just went through this on another discussion. Exact same thing. I have quite a few menu tabs and a couple of them have pretty much text. At 50%, I had two rows of piled-up tabs. Yeeeks! It looked terrible. I changed the 50% to 85 % and it was good to go.
Well I ended up messing with some setting from the link Antechinus posted. Got it to work :D. Altho I have to admit somewhat accidentally lol. A bit of trial and error, but didn't take me long this morning when I could concentrate better on it.
A HUGE thanks to you guys for all your help!!! :D
Cool. It is a nifty trick and should be more widely known. I'll mark this as solved.