News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Adding Nav Buttions in 2.0

Started by RL Joneson, April 05, 2008, 06:32:43 PM

Previous topic - Next topic

RL Joneson

How do you add buttons in 2.0? i see that the language code has changed. I want to simply add custom linked buttons to the nav bar. For instance, an "About" button would link to a custom url.

babjusi

Quote from: RL Joneson on April 05, 2008, 06:32:43 PM
How do you add buttons in 2.0? i see that the language code has changed. I want to simply add custom linked buttons to the nav bar. For instance, an "About" button would link to a custom url.

In the 2.0 that has been moved from the index.template.php file to the Subs.php in the /Sources/ directory so it can affect all templates.

Try to search for
Quote$buttons = array(

RL Joneson

Great! But how do i change the href to link to a url? I put this code in and it isn't working.


'home' => array(
'title' => $txt['home'],
'href' => http://rljoneson.com/faf/home/home.html,
'show' => true,
'sub_buttons' => array(
),
),

Oldiesmann

Make sure $txt['home'] is a real text string.
Michael Eshom
Christian Metal Fans

RL Joneson

It is right? I just wanted to change the link to where the current HOME button goes to.

RL Joneson

I mean that IS a REAL string right? it's out of the languages/englishindex. I just want it to link to the url instead of having it go to the forum home.

smack

I don't think you can change that, $scripturl because it is using the site url from setting i think, then half of your board links wont work.

I would love to add a button to my 2.0 site just to see how it works but I can't find a way to do it.   I guess i will just have to live with it.

Bulakbol

It might work if you sorround your home page with single quote.
'href' => 'http://rljoneson.com/faf/home/home.html',
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

smack

#8
It works like a baby, thanks.

But I would still like to know how to add a button, I am trying to learn as much  as I can.  You just can't copy code like:


'home' => array(
'title' => $txt['home'],
'href' => 'http://www.yoururl.com',
'show' => true,
'sub_buttons' => array(
),
),


And expect a button to apear right? 
There are other places that need to be modified also, is there a place where I can go and learn those steps?

RL Joneson

I've added buttons to mine, but something weird is happening to my finished result. There is a colon ":" at the end of my button name. Here is the code i added to make the new buttons

{
$buttons = array(
'home' => array(
'title' => $txt['home'],
'href' => 'http://rljoneson.com/faf/home/home.html',
'show' => true,
'sub_buttons' => array(
),
),
'events' => array(
'title' => $txt['events'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
'jobs/resumes' => array(
'title' => $txt['jobs'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => $context['allow_search'],
'sub_buttons' => array(
),


And here is where you can view it. rljoneson.com/faf_forum

And here is my index.english code where i added the new labels

$txt['message_index'] = 'Message Index';
$txt['news'] = 'News';
$txt['home'] = 'Home';
$txt['events'] = 'Events';
$txt['jobs'] = 'Jobs/Resumes';


Does anyone know why my "Events"  button has the colon at the end "Events:" ??

RL Joneson

FYI the Jobs/Resume one turned out find. Just the Events has the issue. I can't figure this one out...

Bulakbol

I tried just the events and looks fine here with the default theme.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

RL Joneson

I've tested it on all browsers. IE5 win, IE mac, Safari, Firefox.. and i see the ":" on my Events: button. Does anyone else see it?? i just want to get rid of it.

rljoneson.com/faf_forum

Altair

#13
Try adding an action to the events line. That MIGHT be what is causing it, but I am not to sure.

RL Joneson

Yes there's an ARRAY in the line right?

Nigel

Hi RL Joneson,

I've just searched 'index.english' and $txt['events'] has already been defined. Guess what it's defined as?

So it's probably best if you use another name – editing that entry might have strange consequences elsewhere.

BTW, have you read the note at the top of that file re clearing the cache? That one had me fooled for a while.

Nigel

Bulakbol

There's $txt['calendar4'] = 'Events:'; in the index.english.php. If you just copied it, there's colon at the end. Double check it.  :P
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

metallica48423

Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

RL Joneson

Yes i just changed it in the lang script to say something other than 'events'. i called it 'eventnav'. case closed on this one, however it raises two more questions. will start new threads. thanks SMF team, you guys have the BEST community support out there!

Waxman

#19
where can I find this index.english.php I wish my FTP had a search
man just as he posted I found one.


Advertisement: