Advertisement:

Author Topic: Website Button  (Read 39501 times)

Offline Jade Elizabeth

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,536
  • Gender: Female
  • Keep your enemies close and your friends closer ;)
    • @aCreativeBurrow on Twitter
    • Creative Burrow
Re: Website Button
« Reply #60 on: November 15, 2007, 12:29:25 AM »
use one of the below

http://www.smfhacks.com/packageparser/package.php
http://sleepycode.com/PackageParser/index.php

select the mod from your computer, and then look for whats needed in the display and board templates and make sure its there :D
Once proud Documentation Writer and Help Squad Leader
I'm for HIRE! | Need help? Check out my $5 Fiverr Gigs!


Need More Posts? I TRIPLED my sites activity in 10 days!! YOU CAN TOO!

Quote
[12:13am] <%Jade> link me
[12:14am] <+orstio> <a href="Jade">link</a>


Offline rehan

  • Semi-Newbie
  • *
  • Posts: 76
Re: Website Button
« Reply #61 on: November 15, 2007, 11:30:04 AM »
thX...
It was asking to edit few files which dont exist in my theme folder of city scape..
so i edited my theme file manually and was able to add the new button.. I added 2 buttons doing this.. one for my gallery and other for arcade section...

Offline romuba

  • Semi-Newbie
  • *
  • Posts: 75
  • Gender: Male
  • Bulding Websites the way you like them
    • BartWebSites
Re: Website Button
« Reply #62 on: November 16, 2007, 12:44:52 AM »
That is very good, which file and what did you edit?

Offline rehan

  • Semi-Newbie
  • *
  • Posts: 76
Re: Website Button
« Reply #63 on: November 16, 2007, 01:03:00 AM »
i edited index.template.php file inside my theme folder..

it wasn't hard to understand the button's code...

Code: [Select]
/ Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;

// add buttons here
$context['menubox'] = array();

/*
'title' - the string the link will have
'link' - the actual link
'chosen' - which "current_action" this button belongs to.
'memberonly' - show it JUST for members
'guestonly' - show it JUST for guests
'permission' - any permission you want to check before displaying the button

*/

// home button
$context['menubox'][]=array(
'title' => $txt[103],
'link' => $scripturl,
'chosen' => '',
'memberonly' => false,
'guestonly' => false,
'permission' => '',
);

// Arcade button
$context['menubox'][]=array(
'title' => 'Arcade',
'link' => $scripturl.'?action=arcade',
'chosen' => 'Arcade',
'memberonly' => false,
'guestonly' => false,
'permission' => '',
);

// Gallery button
$context['menubox'][]=array(
'title' => 'Gallery',
'link' => 'http://www.circlebakote.com/gallery/index.php',
'chosen' => 'Arcade',
'memberonly' => false,
'guestonly' => false,
'permission' => '',
);


I just copy pasted the home button code for arcade and gallery..

Offline romuba

  • Semi-Newbie
  • *
  • Posts: 75
  • Gender: Male
  • Bulding Websites the way you like them
    • BartWebSites
Re: Website Button
« Reply #64 on: November 16, 2007, 02:19:13 AM »
Thanks a stack, I will give it a go.

Offline chrishicks

  • Full Member
  • ***
  • Posts: 456
  • Gender: Male
Re: Website Button
« Reply #65 on: February 11, 2008, 10:41:36 AM »
anyone care to give me a tip on how to move the location of the button? its located all the way to the left but I'd like it at the right. dp I just take this code and place it after the code for the button I want it next to?

// Show the [website] button.

   show_websiteButton();
   
   


or is there something else I need to do as well?
« Last Edit: February 11, 2008, 12:26:22 PM by chrishicks »

Offline Jade Elizabeth

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,536
  • Gender: Female
  • Keep your enemies close and your friends closer ;)
    • @aCreativeBurrow on Twitter
    • Creative Burrow
Re: Website Button
« Reply #66 on: February 11, 2008, 11:43:57 AM »
Yeah, thats how you do it :D
If it fails, try again untill you get it right :D
Once proud Documentation Writer and Help Squad Leader
I'm for HIRE! | Need help? Check out my $5 Fiverr Gigs!


Need More Posts? I TRIPLED my sites activity in 10 days!! YOU CAN TOO!

Quote
[12:13am] <%Jade> link me
[12:14am] <+orstio> <a href="Jade">link</a>


Offline djfermin

  • Newbie
  • *
  • Posts: 1
  • Gender: Male
    • Euskalweb
Re: Website Button
« Reply #67 on: February 14, 2008, 02:56:22 AM »
spanish gif ....
« Last Edit: February 14, 2008, 02:58:06 AM by djfermin »

Offline christinedlrp

  • Semi-Newbie
  • *
  • Posts: 32
  • Gender: Female
    • Def Leppard Rocks Page
Re: Website Button
« Reply #68 on: March 14, 2008, 05:21:52 AM »
I'm having trouble adding the website button code to the Exodus theme.  Can someone please add it for me?  :D

Offline 58tbird

  • Jr. Member
  • **
  • Posts: 356
  • Gender: Male
Re: Website Button
« Reply #69 on: March 29, 2008, 03:40:15 PM »
anyone care to give me a tip on how to move the location of the button? its located all the way to the left but I'd like it at the right. dp I just take this code and place it after the code for the button I want it next to?

// Show the [website] button.

   show_websiteButton();
   
or is there something else I need to do as well?

I have the same question - but I don't know what file to make these changes to.  I would like to move it just to the right of the Home tab. Nevermind - I found it in the index.template.php

However, I would like some help on this: when I click the Website tab, it works just fine, but the Home tab remains highlighted.  This give the impression one is still on the Home page.  Any way to make the Home tab return to normal size and dark blue, and make the Website tab enlarge and turn light blue after it's selected?

I noticed that the code for the other tabs (aside from the actual names of the tabs) appear this way:
Code: [Select]
// 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>' : '';
...versus the code I quoted from chrischicks above for the Website Button.  I thought maybe I could simply copy this and change the names to match my new Website tab, but I noticed all the standard tabs contain their own unique number.  In the example shown here for the Home tab, it references "$txt[103]";  Help is "$txt[119]"; Search in "$txt[182]", etc.  Otherwise, they are all the same. 

Does anyone know how to make the new Website tab behave the same way all the other tabs do?
« Last Edit: March 30, 2008, 12:18:59 PM by 58tbird »

Offline perplexed

  • SMF Hero
  • ******
  • Posts: 2,595
  • It's quite perplexing isn't it
Re: Website Button
« Reply #70 on: March 31, 2008, 06:52:44 PM »
$txt['websiteButton_title']   - have you tried adding this in place of the $txt[103]etc?  I haven't tried it myself as I don't have this mod, but in lieu of a better reply...  I would say you need all of what is quoted in your post for the tabs to behave correctly as they have the maintab_active, active_back image references in them

Offline 58tbird

  • Jr. Member
  • **
  • Posts: 356
  • Gender: Male
Re: Website Button
« Reply #71 on: April 01, 2008, 01:00:44 AM »
Thank you my friend!

I hadn't thought of that - I don't really understand code much at all.  I tried your suggestion by replacing:
Code: [Select]
// Show the [website] button.

   show_websiteButton();

with:
Code: [Select]
// Show the [website] button.
echo ($current_action=='News%20Alerts' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'News%20Alerts' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '">' , $txt[‘websitebutton_News Alerts’] , '</a>
</td>' , $current_action == 'News%20Alerts' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

Then when I clicked on my News Alert tab I got the attached error.

The url for the custom action page I created is:
Code: [Select]
http://mywebsite.com/index.php?action=News%20AlertsSo I figured I should put "News%20Alerts" after "action=" to match the other buttons (except Home, which has a different url).  I'm not sure at all if I should put "$txt[‘websitebutton_News Alerts’]" or "$txt[‘websitebutton_News%20Alerts’]" or some other variation.

Also, I don't know if I should replace this
Code: [Select]
// Show the [website] button.

   show_websiteButton();
or add the new code before/after it.

I see what the error highlights, but does that mean that's the only problem?
« Last Edit: April 01, 2008, 01:04:28 AM by 58tbird »


Offline 58tbird

  • Jr. Member
  • **
  • Posts: 356
  • Gender: Male
Re: Website Button
« Reply #73 on: April 01, 2008, 11:34:22 AM »
Thank you for the suggestion to use the Add a Tab Mod.  I already tried that, however, but I couldn't figure out a way to make the new tab open the News Alerts page (created using the Custom Action Mod).  I agree, however, that seems like the more logical approach to this dilemma, and I would prefer to use that solution in case I need to do something this again in the future.
« Last Edit: April 01, 2008, 11:48:22 AM by 58tbird »

Offline perplexed

  • SMF Hero
  • ******
  • Posts: 2,595
  • It's quite perplexing isn't it
Re: Website Button
« Reply #74 on: April 01, 2008, 11:58:41 AM »
@ 58tbird I used to do this for one of my sites and the tab opened the external site no probs.

I have installed the website button again and I have moved italong the tab bar, and tried linking it to various internal forum pages and it works ok.  If you are linking to something inside the forum though then the home tab will stay highlighted probably because you are still there.  I tried linking it to the profile page and that took you to profile and then highlighted the profile tab since that's where I now was.  I think it's working the way it should be.

What page did you want to link it to, something internal or external?  If it's a page within the forum then I think that tab will stay highlighted to indicate you are still on the forum.

Offline 58tbird

  • Jr. Member
  • **
  • Posts: 356
  • Gender: Male
Re: Website Button
« Reply #75 on: April 01, 2008, 01:18:13 PM »
Wow, perplexed, I hope you're not going to too much trouble here for me.  I appreciate all your help on this.

I believe you can view my page here.  It's internal to my forum.  I was hoping to have the tab indicate to members and guests that they are currently on the News Alerts page.  Instead, when they're on this page, it appears by the highlighted Home tab that they're on the Home page.

I'm wondering if $txt[103], etc. refers to a file somewhere that lists the various pages and assigns them a number.  If so, maybe I could assign a number to my News Alerts page so the code will call it just like all the others.  I guess not...according to  How do you add custom tabs   
Quote
    * $current_action=='home' - is what sets the tab for the current actions.  As you can see it is defined in 3 instances.  You will need to change it for all three of them.
    * ' , $txt[103] , ' - is the text string that prints Home on the Main menu.  As you see the variable is inside ' , , '.  The reason for this is because it's inside an echo.  If you are going to hard code the name in the menu you do not need to put ' , , ' around it.

I wonder what I need to do to hard code this, and if that's the solution I'm looking for.
« Last Edit: April 01, 2008, 09:32:44 PM by 58tbird »

Offline 58tbird

  • Jr. Member
  • **
  • Posts: 356
  • Gender: Male
Re: Website Button
« Reply #76 on: April 02, 2008, 02:15:59 AM »
Well, I tried using $txt['websiteButtonAlt_txt'] in the code in place of ' , $txt[103] , ' but it seems the code is ignored and only the
Code: [Select]
// Show the [website] button.

   show_websiteButton();
works.  I tried eliminating it but the result is that clicking on the News Alerts tab has no effect (stays on Home page).

I suspect it must have something to do with the preceding section of the code which seems to define the operation:
Code: [Select]
// Show WebsiteButton
function show_websiteButton()
{
global $context, $txt, $modSettings;

echo $context['browser']['is_ie4'] ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '', '
<td valign="top" class="maintab_back">
<a href="', isset($modSettings['websiteButton_url']) ? $modSettings['websiteButton_url'] : 'http://www.roadrunner.cx', '" alt="', isset($txt['websiteButtonAlt_txt']) ? $txt['websiteButtonAlt_txt'] : 'Website', '">',
isset($txt['websiteButton_txt']) ? $txt['websiteButton_txt'] : 'Website', '</a>
</td>';
}
// 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', 'bookmarks', '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'] == 'news')
$current_action = 'news';
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 '
<table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;">
<tr>
<td class="maintab_' , $first , '">&nbsp;</td>';


// 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>' : '';

// Show the [website] button.

show_websiteButton();

// Show the [help] button.
echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'help' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=help">' , $txt[119] , '</a>
</td>' , $current_action == 'help' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

I just don't know how to read this stuff. :(

Offline ccbtimewiz

  • SMF Hero
  • ******
  • Posts: 5,300
  • Gender: Male
  • OXEN
Re: Website Button
« Reply #77 on: April 02, 2008, 03:10:04 PM »
Here, I've taken the liberty to make my own small modification in the code.

Uninstall the website button modification and place this instead. Please note I am in no way affiliated with the mod author of the Website Button modification and I don't intend to "rival" them. This is just a solution to solve your problem.

Replace the code you posted above with this:

Code: (index.template.php) [Select]
// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;

// Website Button modification.
// --- Main override of the modification. Use "Yes" to enable, use "No" to disable.
$enable_website_button = 'Yes';
// --- Replace this with your own link. Only works if "Yes" is put into the enable_website_button field.
$website_button_link = 'http://www.roadrunner.cx';
// --- The actual text of the button. Only works if "Yes" is put into the enable_website_button field.
$website_button_text = 'Road Runner';
//--------

// 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', 'bookmarks', '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'] == 'news')
$current_action = 'news';
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 '
<table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;">
<tr>
<td class="maintab_' , $first , '">&nbsp;</td>';


// 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>' : '';

// Your [website] 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="'.$website_button_link.'" target="_blank">'.$website_button_text.'</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Show the [help] button.
echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'help' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=help">' , $txt[119] , '</a>
</td>' , $current_action == 'help' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
« Last Edit: April 02, 2008, 03:11:44 PM by ccbtimewiz »

Offline 58tbird

  • Jr. Member
  • **
  • Posts: 356
  • Gender: Male
Re: Website Button
« Reply #78 on: April 03, 2008, 02:30:31 AM »
Thank you ccbtimewiz!  I'm eager to try your solution, however, I'm a little stuck.

I've been trying to uninstall the Website Button mod but two files fail the test.  After using the package parser and making several unsuccessful attempts to locate and correct the manual changes I may have made that are causing the test failure, I dug down through previous backups to my themes/default/index.template.php, and finally found one to revert back to that passes the test. 

But I also fail Themes/default/languages/index.english.php.  I don't remember altering this file manually at all, like I did the index.template.php.  Using the package parser, I see the only thing needed for uninstalling is to delete
Code: [Select]
$helptxt['websiteButton_url'] = 'This is URL where you want your website button to point to, for example http://www.roadrunner.cx';however, I've searched that file and this line doesn't exist. 

Using the package parser, instructions to install show that code is to be added to the end of the file.  I tried adding it here:
Code: [Select]
$txt['websiteButton_txt'] = 'News Alerts';
$txt['websiteButtonAlt_txt'] = 'News Alerts'
;
?>
to look like this:
Code: [Select]
$txt['websiteButton_txt'] = 'News Alerts';
$txt['websiteButtonAlt_txt'] = 'News Alerts'
;
$helptxt['websiteButton_url'] = 'This is URL where you want your website button to point to, for example http://www.roadrunner.cx';
?>
but it still fails the test.  Since I'm new, I don't know if it's safe to go ahead with the uninstall or not.  Can you advise me how I should proceed?

Offline ccbtimewiz

  • SMF Hero
  • ******
  • Posts: 5,300
  • Gender: Male
  • OXEN
Re: Website Button
« Reply #79 on: April 03, 2008, 12:22:14 PM »
Proceed with uninstalling.