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.
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(
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(
),
),
Make sure $txt['home'] is a real text string.
It is right? I just wanted to change the link to where the current HOME button goes to.
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.
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.
It might work if you sorround your home page with single quote.
'href' => 'http://rljoneson.com/faf/home/home.html',
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?
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 (http://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:" ??
FYI the Jobs/Resume one turned out find. Just the Events has the issue. I can't figure this one out...
I tried just the events and looks fine here with the default theme.
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 (http://rljoneson.com/faf_forum)
Try adding an action to the events line. That MIGHT be what is causing it, but I am not to sure.
Yes there's an ARRAY in the line right?
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
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
I made a little thing on constructing your own links...
http://www.simplemachines.org/community/index.php?topic=229686.msg1476576#msg1476576
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!
where can I find this index.english.php I wish my FTP had a search
man just as he posted I found one.
Ok it didn't work
I suscsesfully xhanged the Home button to go to my home page but no new button appered when I tyed in (all in correct specing)
'forum' => array(
'title' => $txt['forum'],
'href' => '$scipturl',
'show' => true,
'sub_buttons' => array(
),
),
I also tried
'forum' => array(
'title' => $txt['forum'],
'href' => '$scripturl . ?action=forum',
'show' => true,
'sub_buttons' => array(
),
),
after i changed my index.english.php to
$txt['message_index'] = 'Message Index';
$txt['news'] = 'News';
$txt['home'] = 'Home';
$txt['forum'] = 'forum';
what did I do wrong?
I also tried changing the name in my index.english.php from
$txt['message_index'] = 'Message Index';
$txt['news'] = 'News';
$txt['home'] = 'Home';
$txt['forum'] = 'forum';
to
$txt['message_index'] = 'Message Index';
$txt['news'] = 'News';
$txt['home'] = 'Home';
$txt['pegasusreplicators_message_boaards'] = 'pegasusreplicators message boards';
and my forums still disappeared(restored backups so site is OK)
Try clearing your file cache in the admin section -> 'Maintenance' menu -> 'Maintenance' tab -> 'Common Tasks' tab -> 'Empty the file cache.' link/option.
Theme/template files in SMF 2 including language files are all cached to save on time and space, because of this you have to wipe the cache before any changes will be loaded.
site still does not show up
/Themes/default/languages
thank you I found it earlier but when i did as you suggested in your tut my board dissapered and I had to load backups, LHVWB said to clear my cache but the didn't help either
I am running the 2.0 beta 3.1 public
I really like this board and want to figure this out
http://www.amenna.nl/forum2/index.php
between index and help there should be lounge
but there is a gap in it, if you searh a bit in the gap you could find it but. the text isn't showing up.....
subs.php
'Lounge' => array(
'title' => $txt['lounge300500'],
'href' => "http://www.amenna.nl/forum2/Lounge.php",
'show' => true,
'sub_buttons' => array(
),
),
index.dutch-utf8.php
$txt['lounge300500'] = 'Lounge';
but it doesn't show up :S
^changed it the $txt['lounge300500'] = 'Lounge'; in 'Lounge' then it shows up, but isn't it better when it has been added to the language files?