Website Button

Started by jake1981, May 19, 2007, 04:03:26 PM

Previous topic - Next topic

58tbird

ccbtimewiz - I really appreciate all your help on this!

I finally got enough time to revert back to an earlier index.template, uninstall the Website Button mod, and manually insert your code into the index.template.

Now, the News Alerts tab is highlighted simultaneously whenever the Home tab is selected.  I checked, and both tabs appear normal when any of the other tabs are selected.

Also, when I select the News Alerts tab, it opens my News Alerts page in a new window (and the Home & News Alerts tabs are highlighted in the new window).

I think if these are my only choices, I would prefer to have my page open within the same window and not have the tab highlight properly as it was before.

You've done quite a bit of work on this so I don't mean to wear out my welcome.  But would it be difficult to correct these two issues?

Again, I truly appreciate you for your help. :)

ccbtimewiz

The website button opens in a new page because I made it do so. I can make it so it opens in the same window, but I cannot make the tab bold. That is impossible because the link you are linking to with the button is an external site.

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


With this:
// 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="_'.$website_button_type.'">'.$website_button_text.'</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


Replace this:
// --- The actual text of the button. Only works if "Yes" is put into the enable_website_button field.
$website_button_text = 'Road Runner';


With this:
// --- The actual text of the button. Only works if "Yes" is put into the enable_website_button field.
$website_button_text = 'Road Runner';
// --- The way the button opens when clicked. Use "blank" to open in a new page or use "self" to open in the same page/tab.
$website_button_type = 'self';


58tbird

Sorry about that ccbtimewiz - I noticed you had it linking to an external site, and I think I remember that being in the code for the Website Button mod, but I replaced it with this: http://mywebsite.com/index.php?action=News%20Alerts which is the link I got from using the Custom Action mod (I went over all this in previous posts, but I failed to mention it in my correspondences with you - I apologize).

So, in your code where you had the link to roadrunner, I replaced it with the link created by the Custom Action mod.

Does this make any difference in being able to make the tab behave like the other tabs?  Thank you very much for all you help on this - I really do appreciate you. :)

ccbtimewiz

Find:
Code (index.template.php) Select
if (in_array($context['current_action'], array(

Replace with:
Code (index.template.php) Select
if (in_array($context['current_action'], array('News%20Alerts',

Please only replace the code I told you. Don't replace the entire array. Easier terms, add 'News%20Alerts' into that array.

Then, using the code I gave you earlier, do this:

Find:
Code (index.template.php) Select
// 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="_'.$website_button_type.'">'.$website_button_text.'</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


Replace with:
// Your [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="'.$website_button_link.'" target="_'.$website_button_type.'">'.$website_button_text.'</a>
</td>' , $current_action == 'News%20Alerts' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

58tbird

#84
Okay - thank you! :)  I'm got to leave right now, but I'll try it later this evening if I don't get a chance sooner.

P.S. In which array do I insert the code? "if (in_array($context['current_action'], array(" occurs twice:
// 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';

58tbird

...oh, never mind - now that I look closer at it, it appears the second occurrence contains code relating to tabs.:-[  I'll insert it into the second array.

58tbird

#86
Okay, I've made the changes in your last post, but it works the same way it did before: it opens in a new window, and the Home tab still highlights - not the News Alerts tab.  I also have 3 pages of errors. 

If there's no way to accomplish this, I can revert back to using the Website Button mod.

I appreciate your help on this ccbtimewiz - thank you very much. :)

FerociousSM

I've installed this mod on SMF 1.1.5. I see the "Features and Options > Website" but nothing appears onmy main page. I'm using the Musiconica theme. Is there any other place to turn it on?

Thx

ccbtimewiz

mm, go through your index.template.php file in your theme and make sure the hacks for the mod are in there.

That's most likely the problem.

elforoof

the mod looks really cool,  when would it be ready for  (Powered by SMF 1.1.5)  thank you

Quote from: jake1981 on May 19, 2007, 04:03:26 PM
Link to Mod

..------=================================
Website Button (wsbutton)
Version 1.1.1

Author: Oskari Rauta/Jake Irons
-----------=======================-------------..

What's new in 1.1.1?
- Fixed couple of typos in readme :)

This mod adds a new button to your forum's navigation bar: website (text can be changed from language file).

It also adds section website to your forum's settings where you can set URL for it.

What is this kind of mod good for? Well, if you have a portal/forum is integrated to site, for e.g. with mkportal, you might want to exit forum to website WITHOUT logging out as you might have there features that require that user is logged on. Most other forums have this feature but smf did miss it. Apply this mod if you need such feature.

It's designed to mimic other forum buttons so it fits very nicely. This mod includes also image buttons for babylon and classic themes in 2 languages: english and finnish.

This mod supports multiple languages and offers out of the box support for english and finnish (if board has finnish language installed). Also if you use core/default theme(buttons without images) and other language than english or finnish, this mod detects that it has not been translated yet for that language and defaults to english. (Not for admin panel though, admin panel part supports english and finnish and if you use other language, you need to add support for your language by changing language files)

Language support: yes, provided: english & finnish
Skin support: yes, provided: core/default, classic and babylon

Works just great with portals / site-integration.

Joe N

Could this be updated to smf 1.1.8?
Microsoft: "We Need to Imagine Life Without Walls."
I Say: "If There are No Walls Who needs Windows."



My Mods (6) All My Mods Updated To SMF 2.0 RC2 and SMF 1.1.10!


Jade Elizabeth

Any mod for 1.1.x will most likely work on 1.1.8 :).
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Joe N

Quote from: Jade Elizabeth on April 22, 2009, 04:45:04 PM
Any mod for 1.1.x will most likely work on 1.1.8 :).

I mean is it comp with 1.1.8?
Microsoft: "We Need to Imagine Life Without Walls."
I Say: "If There are No Walls Who needs Windows."



My Mods (6) All My Mods Updated To SMF 2.0 RC2 and SMF 1.1.10!


Jade Elizabeth

Quote from: Jade Elizabeth on April 22, 2009, 04:45:04 PM
Any mod for 1.1.x will most likely work on 1.1.8 :).

I just said it was :).
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Joe N

Microsoft: "We Need to Imagine Life Without Walls."
I Say: "If There are No Walls Who needs Windows."



My Mods (6) All My Mods Updated To SMF 2.0 RC2 and SMF 1.1.10!


Doyne

I like this Mod.  The only thing is that my button is not aligned with my others.  Do you have a fix for that?

Here is my Mods code in he Index_template file

// Show the start of the tab section.
echo '
  <ul>';

// Show the [website] button.

show_websiteButton();
       

       // Show the [home] button.
echo '<li', $current_action == 'home' ? ' id="active"' : '', '><a href="', $scripturl, '">' , $txt[103] , '</a></li>';

// Show the [help] button.
echo '<li', $current_action == 'help' ? ' id="active"' : '', '><a href="', $scripturl, '?action=help">' , $txt[119] , '</a></li>';

// How about the [search] button?
if ($context['allow_search'])
echo '<li', $current_action == 'search' ? ' id="active"' : '', '><a href="', $scripturl, '?action=search">' , $txt[182] , '</a></li>';

// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo '<li', $current_action == 'admin' ? ' id="active"' : '', '><a href="', $scripturl, '?action=admin">' , $txt[2] , '</a></li>';

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '<li', $current_action == 'profile' ? ' id="active"' : '', '><a href="', $scripturl, '?action=profile">' , $txt[79] , '</a></li>';

// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo '<li', $current_action == 'pm' ? ' id="active"' : '', '><a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a></li>';

// The [calendar]!
if ($context['allow_calendar'])
echo '<li', $current_action == 'calendar' ? ' id="active"' : '', '><a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a></li>';

// the [member] list button
if ($context['allow_memberlist'])
echo '<li', $current_action == 'mlist' ? ' id="active"' : '', '><a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a></li>';

// If the user is a guest, show [login] button.
if ($context['user']['is_guest'])
echo '<li', $current_action == 'login' ? ' id="active"' : '', '><a href="', $scripturl, '?action=login">' , $txt[34] , '</a></li>';

// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo '<li', $current_action == 'register' ? ' id="active"' : '', '><a href="', $scripturl, '?action=register">' , $txt[97] , '</a></li>';


Any ideas how to align the button?

Thanks,

Doyne

ChaosEnergy

will ther ebe an update to smf 2.0 rc2?
Chaos Empire ®

KensonPlays


Owner of Mesozoic Haven

risey

I installed the website button, when i go to Features and Options i get the following error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in D:\Hosting\4378575\html\Forum\Sources\ModSettings.php on line 120

So i had to uninstal, looks a good mod though...

Ryan

eyo

#99
i installed it, found 1 error and reinstalled forum thru backup and reinstalled addbutton and it displays fine , problem is, when i click features and options to set url, i just get a refresh. help pls. im running smf 1.1.12

Advertisement: