TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 136
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 105
  • Total: 105

need to add a forum button to new theme

Started by nood1e, September 28, 2008, 08:27:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nood1e

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>';
}
?>

Thurnok

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.
Thurnok
The one, the only!

nood1e

#2
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:

G6Cad

#3
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.

nood1e

#4
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.php

find:


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.


IchBin

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 Glad you figured it out though.

Ken.

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.

" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.


ob1coyote

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.

IchBin

Any reason you felt to bring up something that was done a month ago? You trying to stir the pot or something?

This website is proudly hosted on Crocweb Cloud Website Hosting.