ok, i did a brief search on this on the forums here and quite a bit through google. i cant seem to find a concrete answer.
i need to add a Forum button right after the Home button on my new theme.
the theme is Abagail.
here is the code in the index.template.php snippet with the button code. ive come to find out that everyone seems to do this code differently, so im posting this one right here. i just need to know what to add and where to add it. im crap with php.
any help would be awesome.
echo '</div>';
}
// 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')))
$current_action = 'admin';
if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))
$current_action = $context['current_action'];
if ($context['current_action'] == 'search2')
$current_action = 'search';
if ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';
// Are we using right-to-left orientation?
if ($context['right_to_left'])
{
$first = 'last';
$last = 'first';
}
else
{
$first = 'first';
$last = 'last';
}
// Show the start of the tab section.
echo '
<div id="nav">
<ul>';
// Show the [home] button.
echo '<li><a' , $current_action=='home' ? ' class="current"' : '' , ' href="', $scripturl, '"><span>' , $txt[103] , '</span></a></li>';
// Show the [help] button.
echo '<li><a' , $current_action=='help' ? ' class="current"' : '' , ' href="', $scripturl, '?action=help"><span>' , $txt[119] , '</span></a></li>';
// How about the [search] button?
if ($context['allow_search'])
echo '<li><a' , $current_action=='search' ? ' class="current"' : '' , ' href="', $scripturl, '?action=search"><span>' , $txt[182] , '</span></a></li>';
// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo '<li><a' , $current_action=='admin' ? ' class="current"' : '' , ' href="', $scripturl, '?action=admin"><span>' , $txt[2] , '</span></a></li>';
// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '<li><a' , $current_action=='profile' ? ' class="current"' : '' , ' href="', $scripturl, '?action=profile"><span>' , $txt[79] , '</span></a></li>';
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo '<li><a' , $current_action=='pm' ? ' class="current"' : '' , ' href="', $scripturl, '?action=pm"><span>' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] .
'</strong>]' : '' , '</span></a></li>';
// The [calendar]!
if ($context['allow_calendar'])
echo '<li><a' , $current_action=='calendar' ? ' class="current"' : '' , ' href="', $scripturl, '?action=calendar"><span>' , $txt['calendar24'] , '</span></a></li>';
// the [member] list button
if ($context['allow_memberlist'])
echo '<li><a ' , $current_action=='mlist' ? ' class="current"' : '' , ' href="', $scripturl, '?action=mlist"><span>' , $txt[331] , '</span></a></li>';
// If the user is a guest, show [login] button.
if ($context['user']['is_guest'])
echo '<li><a ' , $current_action=='login' ? ' class="current"' : '' , ' href="', $scripturl, '?action=login"><span>' , $txt[34] , '</span></a></li>';
// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo '<li><a ' , $current_action=='register' ? ' class="current"' : '' , ' href="', $scripturl, '?action=register"><span>' , $txt[97] , '</span></a></li>';
// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo '<li><a ' , $current_action=='logout' ? ' class="current"' : '' , 'href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '"><span>' , $txt[108] , '</span></a></li>';
echo '
</ul></div>';
}
// Generate a strip of buttons.
function template_button_strip($button_strip, $direction = 'top', $force_reset = false, $custom_td = '')
{
global $settings, $buttons, $context, $txt, $scripturl;
// Create the buttons...
foreach ($button_strip as $key => $value)
{
if (isset($value['test']) && empty($context[$value['test']]))
{
unset($button_strip[$key]);
continue;
}
elseif (!isset($buttons[$key]) || $force_reset)
$buttons[$key] = '<a href="' . $value['url'] . '" ' .( isset($value['custom']) ? $value['custom'] : '') . '>' . $txt[$value['text']] . '</a>';
$button_strip[$key] = $buttons[$key];
}
if (empty($button_strip))
return '<td> </td>';
echo '
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_' , $context['right_to_left'] ? 'last' : 'first' , '"> </td>
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_back">', implode(' | ', $button_strip) , '</td>
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_' , $context['right_to_left'] ? 'first' : 'last' , '"> </td>';
}
?>
That's pretty funny. I just did a search for "add a forum button" and the second topic (this topic right here was first since it was the most recent) seems to be exactly what you purported to search for.
You need to do a better job of searching.
the second post that comes up (the one after mine) i already tried with no success BEFORE i posted. so maybe next time you should try to be helpful instead of spamming and trying to sound like a badass.
any help on this would be appreciated. if you cant help please dont post.
-------
edit
-------
and you of all people should know better than to post useless info in a "help" thread...it seems that you are staff here. :uglystupid2:
If i were you i would take the time and relax, read our posting guides as we ask for a few simple things we need to know.
It's our free time we help out on here, we do not get paied to help, so we do like members to actually help them selfs with the small things we ask of them.
If you feel that we dont help you, then feel free to batch on us and see it will help you get what you ask for, we are people, not robots, we do this cause we like to, not because we must or have to serve anyone on a silverplatter.
The post thurnok showed you to are the help you need, take your time and try it again and you will probably see that you yourself made an error first. So please, stop battering on the hand that provide you with free things onour free time, thats not a good way to go.
The abagail theme creator would probably be the one that can help you the best as they should know the code for it right away.
Also the code is not that complext to just copy and add your own action to it with the help from the default themes forum button.
rant first, solution last. can mark this support request as resolved.i know you give your time for free and help a lot of people. thats fantastic! i do the same on my own forum site. but i did say in my first post that i looked already and found nothing useful.
Quoteok, i did a brief search on this on the forums here and quite a bit through google. i cant seem to find a concrete answer
i tried the thing in that post that was recommended to me
before i posted this thread, it didnt work...im sure it was not my error. maybe some variation of that would work, but not exactly what they said. im crap with php and am not the best at improvising from loose instructions.
and the post from Thurnok, you have to admit, was insulting. trying to make me sound like an idiot by suggesting that i didnt already do a search when i stated very clearly that i already did and didnt have any luck. if he wanted to be helpful and link me to that post and explain what i might have done wrong, that would have been helpful. or even
asking me if i tried that
before belittling me. but if youre saying that you guys put in a lot of free time and that means condescending posts are considered helpful and shouldnt be pointed out and the poster made a fool of, then thats just crazy. im sure thats not the way you guys operate here...i hope not.
i did find the answer elsewhere though, for anyone wanting to know. its very easy. embarrassingly easy actually. well, here it is.
-------------------------------------------------
Adding a forum button when the theme doesnt show it by default:In your
index.template.php from your currently installed theme, found in
[forum install directory]>Themes>[current theme]>index.template.phpfind:
if ($context['current_action'] == 'search2')
$current_action = 'search';
and
add after it:
//add the 'forum' action
if ($context['current_action'] == 'forum')
$current_action = 'forum';then
find:
echo '<li><a' , $current_action=='home' ? ' class="current"' : '' , ' href="', $scripturl, '"><span>' , $txt[103] , '</span></a></li>';
and
add after:
// Show the [Forum] button.
echo '<li><a' , $current_action=='forum' ? ' class="current"' : '' , ' href="', $scripturl, '?action=forum"><span>' , Forum , '</span></a></li>';
that should have you fixed up. worked like a charm for me.
Looking from our side Noodle it didn't look like you did any searching. Mainly, because we know we've answered this questions a hundred times at least. And its also a document in our Docs board. TinyPortal Doc's Board (http://docs.tinyportal.co.uk/index.php) Glad you figured it out though.
nood1e, why not give it a rest for a moment and give this a little thought... You and I had an exchange yesterday and although it worked out OK for you on your issue at that time you come back today and get offended because you didn't like the reply you got... chances are great that Thurnok had read the exchange we had, thus his reply. The fact is that I asked you yesterday to "Read the Posting Guidelines" yet in this topic you still haven't posted your info so when you say, "if he wanted to be helpful and link me to that post and explain what i might have done wrong" the fact is that he could not give an answer because he has no idea of what you are running.
Trust me, no one here is trying to pick on you but if you don't follow the posting guidelines then we are not going to be able to give you an answer with out wading through a page or two of back and forth while we try to find out what versions of whatever software you have before we finally get to a resolution.
/thread
problem solved
Thurnoks response was insulting and every post since then has just been to burn noodles for it. Just like every other help forum on the net, everyone's more interested in being forum cops than actually being helpful. I'd rather read the solution reguardless of where it was posted or how many times it was posted.
Thanks to noodle for posting a solution, I will try it later.
If it doesn't work I'll just delete TP from my site rather than come here looking for help.
Any reason you felt to bring up something that was done a month ago? You trying to stir the pot or something?
Yeah.. that's it, pot stirring is my thing... guess last word is yours.
I work in IT and just get sick of going to forums to look for a documented solution and you have to sift through 5000 HiJackThis logs that people are forced to post before they can get an answer to an issue that has nothing to do with spyware. And forum snobs NOT helping....
I don't know squat about PHP and I need help. I've needed help many times over the past few years and, despite having run into this snobbery many times myself, I somehow managed to run several forums of my own and several for friends/coworkers. I've never gone broke or crashed a server by simply helping people when they ask for it...
So... day old, month old, year old, I fail to see the point. You have a good product. Sometimes (in the hands of people like myself) it doesn't work the way its expected to. Attention to good customer service is as important as having a good product. That is true no matter what you charge and no matter how big, or small you are. It could make all the difference in how many people hit that PayPal Donate button.
/rant
Thanks again to Nood1e :up:
So its snobbery that we should expect a little bit of work on the users part? I did a search for "add button" and came up with about 5 different topics on the first page of results for the answer. Thurnok never indicated that the user didn't search, he suggest he do a better job at searching. Which was a little harsh, but not over the top IMO. Everything here is free. The support, help, code, and application. I don't know how any more could be expected for what is given so freely. I work in IT as well, and if there's one thing I've learned, its to be up front with information. Such as the hijackthis logs. Thats why we ask so many times for people to read the posting guidelines. Searching is part of those guidelines. I find it hard to believe that a search didn't yeild any proper result. 99 time out of a 100 the theme (if its a theme from this site) already has a post in its dedicated board showing how to add a button to the theme.
As a sidenote to this, the code posted were wrong and you should change one little thing ( I changed it in your posted code ), but this part
// Show the [Forum] button.
echo '<li><a' , $current_action=='home' ? ' class="current"' : '' , ' href="', $scripturl, '?action=forum"><span>' , Forum , '</span></a></li>';
Should be
// Show the [Forum] button.
echo '<li><a' , $current_action=='forum' ? ' class="current"' : '' , ' href="', $scripturl, '?action=forum"><span>' , Forum , '</span></a></li>';
The echo '<li><a' , $current_action=='home' ? ' needs be be echo '<li><a' , $current_action=='forum' ? ' instead :D
HAHA... predictable, IchBinâ,,¢. just can't let it go.
My original post was intended to thank Nood1es for his help AND to also to point out that he, a USER, was the only one to post anything slightly helpful in the entire thread.
See G6s post? That's helpful. All your posts, not even close. My posts? Even less that helpful, but then I was just trying to thank nood1es..
Should you expect some work from the user? Of course you should. Should you respond with the perceived attitude of "read the guidelines you twit"? NO!
It is entirely possible to be helpful and at the same time remind the user that there are "posting guidelines", not posting laws, that should be followed. And, if you have to remind EVERY user of that, oh well, it's to be expected... it's part of "customer service".
I supervise an entire helpdesk department (nothing fancy) and employees like G6 get bonuses, clients like nood1es I go the extra mile for, employees with your attitude towards support either move on to other things or drag their heels until they're handed an obligatory promotion or passed off to another department.
Sure, I'm being inflammatory and a bit rude but, I'm not the one representing your product. You really should consider what I'm saying. I'm not entirely wrong.
Thanks again to G6 and Nood1es.
If you start doing support for free for all your products/services then maybe you would be right. But until then, you will never understand nor have any opinion that carries any weight with me. Touting the "I work in customer service" flag isn't going to get you any where with me, especially considering you're the one that felt it necessary to bring up old dirt. I can see that you're the type of guy that I wouldn't want to work for, nor have working under me, by not letting things of the past be "things of the past". And this "perceived attitude" is exactly that, Perceived. Nothing more, nothing less. And the fact that you say that I haven't been helpful here shows just how much of a good boss you are at noticing the things that your employees do. I even posted a link to our docs board to help noodles on the first page. lol Nice try here to make us look bad. I never said it wasn't wrong or right, I just said it was wrong of you to dig up the dirt again. Get over it, and move on already.
Go B0ss! :up:
ICH is one of the nicest guys here. I know.. he has done a lot for me and others here on tp and i would gladly listen to anything he has to say.. I wouldnt be where i was if not for him, Bloc, and especially Crip.. ;)
maybe just a bad day... everyone has them and hopefully tomorrow will be even better.. any more issues, just post.. ^-^