Advertisement:

Author Topic: Adding Nav Buttions in 2.0  (Read 11599 times)

Offline RL Joneson

  • Jr. Member
  • **
  • Posts: 100
  • Gender: Male
  • RL Joneson. Design. Web. Print.
    • RL Joneson. Design. Web. Print.
Adding Nav Buttions in 2.0
« 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.

babjusi

  • Guest
Re: Adding Nav Buttions in 2.0
« Reply #1 on: April 05, 2008, 06:37:29 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(

Offline RL Joneson

  • Jr. Member
  • **
  • Posts: 100
  • Gender: Male
  • RL Joneson. Design. Web. Print.
    • RL Joneson. Design. Web. Print.
Re: Adding Nav Buttions in 2.0
« Reply #2 on: April 05, 2008, 07:08:11 PM »
Great! But how do i change the href to link to a url? I put this code in and it isn't working.


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

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,925
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: Adding Nav Buttions in 2.0
« Reply #3 on: April 05, 2008, 07:29:11 PM »
Make sure $txt['home'] is a real text string.
Michael Eshom
Cincy Space - now open!

Offline RL Joneson

  • Jr. Member
  • **
  • Posts: 100
  • Gender: Male
  • RL Joneson. Design. Web. Print.
    • RL Joneson. Design. Web. Print.
Re: Adding Nav Buttions in 2.0
« Reply #4 on: April 05, 2008, 07:31:45 PM »
It is right? I just wanted to change the link to where the current HOME button goes to.

Offline RL Joneson

  • Jr. Member
  • **
  • Posts: 100
  • Gender: Male
  • RL Joneson. Design. Web. Print.
    • RL Joneson. Design. Web. Print.
Re: Adding Nav Buttions in 2.0
« Reply #5 on: April 05, 2008, 07:53:30 PM »
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.

Offline smack

  • Semi-Newbie
  • *
  • Posts: 48
  • Gender: Male
    • Air Warrior Online
Re: Adding Nav Buttions in 2.0
« Reply #6 on: April 05, 2008, 09:12:02 PM »
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.

Offline Bulakbol

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,220
  • Gender: Male
  • JohnyB
Re: Adding Nav Buttions in 2.0
« Reply #7 on: April 05, 2008, 10:20:35 PM »
It might work if you sorround your home page with single quote.
Code: [Select]
'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

Offline smack

  • Semi-Newbie
  • *
  • Posts: 48
  • Gender: Male
    • Air Warrior Online
Re: Adding Nav Buttions in 2.0
« Reply #8 on: April 06, 2008, 07:13:55 AM »
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:

Code: [Select]
'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?
« Last Edit: April 06, 2008, 07:20:50 AM by smack »

Offline RL Joneson

  • Jr. Member
  • **
  • Posts: 100
  • Gender: Male
  • RL Joneson. Design. Web. Print.
    • RL Joneson. Design. Web. Print.
Re: Adding Nav Buttions in 2.0
« Reply #9 on: April 06, 2008, 01:20:37 PM »
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

Code: [Select]
{
$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

Code: [Select]
$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:" ??

Offline RL Joneson

  • Jr. Member
  • **
  • Posts: 100
  • Gender: Male
  • RL Joneson. Design. Web. Print.
    • RL Joneson. Design. Web. Print.
Re: Adding Nav Buttions in 2.0
« Reply #10 on: April 06, 2008, 01:24:29 PM »
FYI the Jobs/Resume one turned out find. Just the Events has the issue. I can't figure this one out...

Offline Bulakbol

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,220
  • Gender: Male
  • JohnyB
Re: Adding Nav Buttions in 2.0
« Reply #11 on: April 06, 2008, 02:04:34 PM »
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

Offline RL Joneson

  • Jr. Member
  • **
  • Posts: 100
  • Gender: Male
  • RL Joneson. Design. Web. Print.
    • RL Joneson. Design. Web. Print.
Re: Adding Nav Buttions in 2.0
« Reply #12 on: April 06, 2008, 04:35:52 PM »
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

Offline Altair

  • Jr. Member
  • **
  • Posts: 245
Re: Adding Nav Buttions in 2.0
« Reply #13 on: April 06, 2008, 04:43:42 PM »
Try adding an action to the events line. That MIGHT be what is causing it, but I am not to sure.
« Last Edit: April 06, 2008, 06:30:59 PM by Altair »

Offline RL Joneson

  • Jr. Member
  • **
  • Posts: 100
  • Gender: Male
  • RL Joneson. Design. Web. Print.
    • RL Joneson. Design. Web. Print.
Re: Adding Nav Buttions in 2.0
« Reply #14 on: April 06, 2008, 05:23:51 PM »
Yes there's an ARRAY in the line right?

Offline Nigel

  • Jr. Member
  • **
  • Posts: 184
Re: Adding Nav Buttions in 2.0
« Reply #15 on: April 06, 2008, 06:09:46 PM »
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

Offline Bulakbol

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,220
  • Gender: Male
  • JohnyB
Re: Adding Nav Buttions in 2.0
« Reply #16 on: April 06, 2008, 10:37:32 PM »
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

Offline metallica48423

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,842
  • Gender: Male
  • Professional Multislacker!
    • Zentendo
Re: Adding Nav Buttions in 2.0
« Reply #17 on: April 06, 2008, 11:35:54 PM »
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

Quote
Microsoft 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
     

Offline RL Joneson

  • Jr. Member
  • **
  • Posts: 100
  • Gender: Male
  • RL Joneson. Design. Web. Print.
    • RL Joneson. Design. Web. Print.
Re: Adding Nav Buttions in 2.0
« Reply #18 on: April 07, 2008, 11:42:39 AM »
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!

Offline Waxman

  • Semi-Newbie
  • *
  • Posts: 22
  • Gender: Male
  • Goofball
    • Pegasus Replicators
Re: Adding Nav Buttions in 2.0
« Reply #19 on: June 07, 2008, 02:34:15 AM »
where can I find this index.english.php I wish my FTP had a search
man just as he posted I found one.

« Last Edit: June 07, 2008, 02:37:23 AM by Waxman »