Adding link to default theme tab menu

Started by Achilles991, March 06, 2007, 02:45:10 AM

Previous topic - Next topic

Achilles991

I searched a lot for this before, and now i am making one tutorial how to add link in tab menu for default theme (NO IMAGE BUTTON)

Down are 3 templates: for logged members only, guests only, and for all visitors.

You have to edit index.template.php for this action. ( in Themes/default/)

All you have to do is to change two things in this line <a href="http://www.yoururl.com">' , 'custom' , '</a> replace http://www.yoururl.com with url that you want, and after that to change text costum to text that will be displayed in tab menu.

Paste that code after this:
// the [member] list button
if ($context['allow_memberlist'])
echo ($current_action == 'mlist' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'mlist' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a>
</td>' , $current_action == 'mlist' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';



Note: You can paste it before this if you want, that will just change position.

And one more think thing: If you want to use more custom tabs i purpose you to change custom word everywhere. You can put custom1, custom2 or anything else.

This template is for logged members:

// Show the [custom] button for logged members
if ($context['user']['is_logged'])
echo ($current_action=='custom' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'custom' ? 'active_back' : 'back' , '">
<a href="http://www.yoururl.com">' , 'custom' , '</a>
</td>' , $current_action == 'custom' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';



This template is for Guests only:

// Show the [custom] button for Guests only
if ($context['user']['is_guest'])
echo ($current_action=='custom' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'custom' ? 'active_back' : 'back' , '">
<a href="http://www.yoururl.com">' , 'custom' , '</a>
</td>' , $current_action == 'custom' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';



This is template for all visitors:

// Show the [custom] button for all visitors
echo ($current_action=='custom' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'custom' ? 'active_back' : 'back' , '">
<a href="http://www.yoururl.com">' , 'custom' , '</a>
</td>' , $current_action == 'custom' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';



If you would like to make link for any action in forum like Arcade or Who is online, you should replace <a href="http://www.yoururl.com">' , 'custom' , '</a> with <a href="', $scripturl, '?action=nameofaction">' , 'nameofaction' , '</a>

Example for Arcade:
// the [arcade] list button
if ($context['allow_memberlist'])
echo ($current_action == 'arcade' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'arcade' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=arcade">' , 'Arcade' , '</a>
</td>' , $current_action == 'arcade' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


Achilles991

Oh yes... I wanted to do that before 1 month and i couldnt find it...

Dragooon


motorna_testera

#4
i've done all this but nothing :S

is there anything to do with my serbian utf8 lang?

Quote// Show the [AnaBebic.com] button for all visitors            
   echo ($current_action=='AnaBebic.com' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
            <td valign="top" class="maintab_' , $current_action == 'AnaBebic.com' ? 'active_back' : 'back' , '">
               <a href="hxxp:www.anabebic.com/ [nonactive]">' , 'AnaBebic.com' , '</a>
            </td>' , $current_action == 'AnaBebic.com' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

and i even added
Quote$txt['AnaBebic.com'] = 'AnaBebic.com';
in my lang file


Achilles991

Ne znam sta da ti kazem... Mozda si negde slucajno obrisao neki znak... evo ti moja msn adresa, pa mi se javi sutra da ti pomognem... [email protected]

Gary

motorna_testera,

Change

<a href="http://www.anabebic.com/">' , 'AnaBebic.com' , '</a>

to:

<a href="http://www.anabebic.com">AnaBebic.com</a>

Unless you want to use a language string then it'd be:

<a href="http://www.anabebic.com">' , $txt['AnaBebic.com'] , '</a>
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

motorna_testera

#7
still nothing...

i even tried to duplicate home button string
Quote// Show the [home] button.
   echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
            <td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
               <a href="', $scripturl, '">' , $txt[103] , '</a>
            </td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
(that should put two home buttons in menu?)

and nothing happened...

P.S.
i forgot to tell u that i dont use a default theme...
i use 1.1.5 theme on SMF 1.1.7

so my question and your answers are offtopic i guess :D

can someone split topic in new one? :D

Gary

If you're not using the default theme, then you use the same process (though the original post is slightly incorrect, here's the correct method) but do it on your custom theme's copy of index.template.php instead of the default's.
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

motorna_testera

i did it :D

thanx...

my stupidity done all the work in default theme folder and not in template folder D:


Advertisement: