News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

WoW - World of Warcraft Tooltips

Started by Garou, March 28, 2009, 04:31:05 AM

Previous topic - Next topic

Garou

WoW - World of Warcraft Tooltips v1.4





Introduction:
This Mod provides several ways to add World of Warcraft tooltips to your site using the Wowhead Power Java script.

Features:
Users can enter any item url from www.Wowhead.com and will see a tooltip with the item's statistics hover over the post.

When clicked on, users will be taken to Wowhead's page for the item.

There are several ways tooltips can be entered using by links from wowhead.com

For instance the Lightbringer Faceguard can be entered in a post as...
http://www.wowhead.com/?item=30987

Alternatively BBS codes can be used to make links easier to read...
Lightbringer Faceguard
Would be entered like...
[url=http://www.wowhead.com/?item=30987]Lightbringer Faceguard[/url]

A new wow BBC code and button has also been added allowing your users to enter...
[wow]Item Name[/wow]
or
[wow]Item Number[/wow]

The text will display in the post with the text in items quality color and the tool tip.

Note: Quests, Spells, and Achievements are not currently supported using the wow bbc only direct links.

Install:
To install, simply upload the entire zip file to the package manager (Admin -> Package Manager -> Download New Packages).

Your site must have libcurl or fopen in order for this mod to work.

To install the WoW - Tooltips mod on custom themes...

Copy the ./themes/default/images/bbc/wow.gif to the /images/bbc of your theme directory.

Open the themes ./index.template.php
add...
<script src="http://www.wowhead.com/widgets/power.js"></script>
<script src="wow/jquery-1.3.2.min.js"></script>
<script src="wow/wowhead_linker.js"></script></script>

before...
</head>

Open the themes /languages/Modifications.english.php
and add...
$txt['wow'] = 'WoW Tooltip';>
before...
</?>

Note: Some custom themes deviate from the standard index.template.php and may look like...
      // ]]></script>';

   echo '
</head>

replace with...
      // ]]></script>

<script src="http://www.wowhead.com/widgets/power.js"></script>
<script src="wow/jquery-1.3.2.min.js"></script>
<script src="wow/wowhead_linker.js"></script> ';

   echo '
</head>


If you are using 1.1.x you will also have to modify your themes ./Post.template.php
add...
'wow' => array('code' => 'wow', 'before' => '[wow]', 'after' => '[/wow]', 'description' => $txt['wow']),
before...
'flash' => array('code' => 'flash', 'before' => '[flash=200,200]', 'after' => '[/flash]', 'description' => $txt[433]),


Known Issues:
For some users, if your forum is not in the root directory for your website this mod may not work correctly. Copying the wow folder found in yoursite.com/yourforum/wow to yoursite.com/wow will fix this in many cases.

Some hosts for security reasons will require you to set the file permissions (chmod) for the wow folder and the files within to 644 or rw-r-r.

Having Search Engine Friendly URLs turned on can cause the mod to fail.

Many web-hosts are using a utility known as ModSecurity to help protect the sites they host from hackers. Unfortunately ModSecurity is made overly secure and often can create false positives for many web programs including this one. You have have to contact your host and have them read http://blog.modsecurity.org/2007/02/handling-false.html. It will help them to create a personal rule for ModSecurity that recognizes the files in the wow folder as safe.

Compatibility:
Tested under SMF Versions 1.1.8 - 1.1.10 and 2.0 RC1 - 2.0 RC2

Credits:
Thanks to the team at Wowhead for writing the Powered by Wowhead Script.
Also thanks to Horris for writing the phpBB mod that this mod is based on, as well as the included wowhead scripts in the wow folder.

Change log:
Version: 1.4 April 18, 2010
* Modified to work with changes at Wowhead.

Version: 1.3 January 1, 2010
Added Item ID's to the wow bbc code to make it easier to link to the exact item you are looking for. Thanks to Axodious for providing the code.

Version: 1.2 November 09, 2009
* Updated to be compatible with SMF 2.0RC2 as some of the hooks that this code attaches to have been changed.

Version: 1.1 March 28, 2009
  Wowhead support added
  Interface made more simple by using Wowhead wrapper and linker Java Scripts
* Button Changed from a Thottbot specific button to a World of Warcraft button
*! All Thottbot options removed from 2.x due to conflicts with the thottbot power.js and 2.x
> Thottbot support may be re-added at a later date, when conflicts can be resolved

Version: 1.0 February 10, 2009
   Adds the Powered by Thottbot java script to the index.template.php
   Adds the [thott=][/thott] bbc code
   Adds a button for easier usage of the bbc code

Change log:
Legend:
! bug fix
  added feature
* changed
> comment



Most issues can be fixed by referring to this post
Quote from: Garou on February 12, 2011, 01:42:02 PM
I have had it running on my guilds website for several months now, using RC4 and the current version of the mod.

The mod installs using some generic coding that works for most sites but sometimes you get better results by customizing it to run on your site.

Make sure the wow folder is in the root directory of your site, example yoursite.com/wow. Due to the limitations of SMF the mod can not place it there for you, as such it gets installed forums root directory which may not be the root for your site.

Using direct links to the wow folder in your themes ./index.template.php sometimes works better then the defaults. find and change to...
<script src="http://www.wowhead.com/widgets/power.js"></script>
<script src="http://yoursite.com/wow/jquery-1.3.2.min.js"></script>
<script src="http://yoursite.com/wow/wowhead_linker.js"></script></script>


./Sources/Subs.php also has a line that uses a generic link
'content' => '<b><a style="background-color:#303030" href="wow/wowhead_wrapper.php?item=$1" class="wowhead">[$1]</a></b>',

Change to...
'content' => '<b><a style="background-color:#303030" href="http://yoursite.com/wow/wowhead_wrapper.php?item=$1" class="wowhead">[$1]</a></b>',

After that it comes down to your hosts specifications for file permissions and applying that to the contents of the wow folder, usually 655 or 644 will work.

Customizing the mod to your site as outlined above will fix most possible issues. Checking the error log provided by your host (not the one in SMF) will usually tell you exactly what is wrong.

The one potential issue that there is nothing I can do to fix, depends on if your host is using mod_security along with certain rules sets. Some of the java code used in the mod to find an item by name or number and set the color of the link based on the items quality, triggers false positives as an injection script under certain rules for that program.

The codes used by this mod are completely safe and will not harm your site or their server in anyway. However as some malicious hackers out there sometimes use similar coding, some rule sets for mod_security will block the scripts the mod uses from running. You either have to get your host to white list the scripts in the wow folder as safe (the preferred method). You can also get them to turn off those particular rule sets but that can potentially open up your site to attacks by others.

The mod_security issues and fixes were posted long ago on their official blog. http://blog.modsecurity.org/2007/02/handling-false.html

Riggs

WOOT!  Perfect!  Couldn't be any easier.  :)  Thank you SO MUCH!

KillerZ

I get this an error trying to install

3. Execute Modification ./Themes/default/index.template.php Test failed

I am not going to use the default theme so will this make any difference? Also I am using 1.1.8 and the ironwow theme. Thanks. Looks great and worked perfect on my test site.

dr.wills

 :D would really be useful for a game forum
http://movies-on-mediafire.com

Never dying collection of high definition mediafire movies link

Garou

Thank you Riggs.  :)

KillerZ, On every theme you use on your site you will need edit the index.template.php
find...
</head>
Then enter
<script src="http://www.wowhead.com/widgets/power.js"></script>
<script src="wow/jquery-1.3.2.min.js"></script>
<script src="wow/wowhead_linker.js"></script>

just before that.

The install on the mod actually looks for a blank line before the close head tag, I'm pretty sure that's whats causing your error and Ill have to fix that at some point. Just install anyway and manually install the code above.

LOL akaiphan, that's exactly why I ported it over to SMF.

The reason I tracked this down and ported it over to SMF is twofold. Darkcloud hasn't updated the Itemstats mod over to 2.0 yet and one of the guild sites I work on is upgrading. The other is that this mod doesn't require you to store the Item info in your database. It just pulls it directly from Wowhead. I prefer it that way.  :)


Riggs

#5
Quote from: Garou on March 28, 2009, 04:31:05 AM
To install the WoW - Tooltips mod on other themes...
Open the themes /index.template.php
add...
<script src="http://www.wowhead.com/widgets/power.js"></script>
<script src="wow/jquery-1.2.1.js"></script>
<script src="wow/wowhead_linker.js"></script></script>

before...
</head>

Open the themes /languages/Modifications.english.php
and add...
$txt['wow'] = 'WoW Tooltip';>
before...
</?>

You will also have to copy the ./themes/default/wow folder to your theme directory,
also you will have to copy the ./themes/default/images/bbc/wow.gif to the /images/bbc of your theme

directory.

If you are using 1.1.x you will also have to modify your themes /Post.template.php
add...
'wow' => array('code' => 'wow', 'before' => '[wow]', 'after' => '[/wow]', 'description' => $txt['wow']),
before...
'flash' => array('code' => 'flash', 'before' => '[flash=200,200]', 'after' => '[/flash]', 'description' => $txt[433]),


Couple things with this....

The wow folder (at least for me) was found in the root directory.  I couldn't find a wow folder in themes/default.  My theme also doesn't have a languages/Modifications.english.php file.  I also couldn't find the Post.template.php file for my theme.

Here's my site btw....

http://ratemyui.net [nofollow]

I'm trying to get it to work with Dziner's Overview Theme

Degilion

is their a way to use this mod WITHOUT the function fopen() ??

Garou

Riggs, I forgot that the WoW folder goes to the boarddir, You wont need to copy that over, sorry.

If your theme doesn't have its own language files or Post.template.php then SMF should use the ones in the default theme. Essentially you should just have to put JavaScript includes before the close head tag.

If that doesn't do it then Id say copy your Language files and the Post.template.php from the defult theme to your custom theme.

Degilion, the scripts that make this mod so easy where you just have to add the name and the mod does the rest, changing the color and providing the link to the item on Wowhead, requires either fopen or for curl to be installed on your server. Curl is actually the preferred method according to the guy that wrote the original scripts for the phpbb version of the mod.

Thanks to a tip from the SMF Customization Team the mod will check to see if curl is installed on the server and if not then it will try to use fopen (prior to that admins had to manually edit the scripts to switch to fopen). If neither is installed then the mod won't work as intended. However the standard links to Wowhead should work, they just don't look as nice. :(

KillerZ

I installed and did the edits to the index.template.php but when I make the links they all come up light blue with no mouseover. If I click them I get a page looking like this

<?xml version="1.0" encoding="UTF-8" ?>
- <wowhead>
- <item id="40343">
- <name>
- <![CDATA[ Armageddon
  ]]>
  </name>
  <level>213</level>
  <quality id="4">Epic</quality>
- <class id="2">
- <![CDATA[ Weapons
  ]]>
  </class>
- <subclass id="8">
- <![CDATA[ Two-Handed Swords
  ]]>
  </subclass>
  <icon displayId="54560">INV_Sword_104</icon>
  <inventorySlot id="17">Two-Hand</inventorySlot>
- <htmlTooltip>
- <![CDATA[ <table><tr><td><b class="q4">Armageddon</b><br /><!--bo-->Binds when picked up<table width="100%"><tr><td>Two-Hand</td><th>Sword</th></tr></table><table width="100%"><tr><td>554 - 831 Damage</td><th>Speed 3.40</th></tr></table>(203.7 damage per second)<br />+101 Strength<br />+108 Stamina<!--e--><!--ps--><br />Durability 120 / 120<br />Requires Level 80</td></tr></table><table><tr><td><span class="q2">Equip: Improves critical strike rating by 58&nbsp;<small>(<!--r80:32:58-->1.26%&nbsp;@&nbsp;L80)</small>.</span><br /><span class="q2">Equip: Improves haste rating by 100&nbsp;<small>(<!--r80:36:100-->3.05%&nbsp;@&nbsp;L80)</small>.</span></td></tr></table>
  ]]>
  </htmlTooltip>
- <json>
- <![CDATA[ id:40343,name:'3Armageddon',level:213,reqlevel:80,dps:203.7,speed:3.40,slot:17,source:[2,5],sourcemore:[{t:2,ti:181366,n:'Four Horsemen Chest',z:3456,dd:2},{t:1,ti:26309,n:'Weapons Vendor'}],classs:2,subclass:8
  ]]>
  </json>
- <jsonEquip>
- <![CDATA[ slotbak:17,displayid:54560,reqlevel:80,dmgmin1:554,dmgmax1:831,dmgtype1:0,speed:3.40,critstrkrtng:58,hastertng:100,str:101,sta:108,dura:120,dps:203.7,buyprice:1238412,sellprice:247682,mledps:203.7,mledmgmin:554,mledmgmax:831,mlespeed:3.40
  ]]>
  </jsonEquip>
  <link>http://www.wowhead.com/?item=40343</link>
  </item>
  </wowhead>


Would it be that the required programs are not installed on the server? My test server and this one are not on the same host so I am not sure. Thanks again.

Riggs

Could you take a look at my site?  http://ratemyui.net.  I've done as you say in your directions by adding the script lines before the </head> command.  When I look at the site's source, I'm seeing the code for the scripts, but it's not working on the theme, only the default SMF theme.  When looking at the link for one of the items in my test post, I am getting this:

http://ratemyui.net/wow/wowhead_wrapper.php?item=Sharp-Barbed%20Leather%20Belt [nofollow]

instead of what I should be getting, which is just the link to the item on Wowhead.  Thanks for the help!  I really do appreciate it.

Garou

Ok Riggs and KillerZ, after testing the IronWoW and the Overview themes, both have the exact same issue.

The index.template.php for both looks like this at the end head tag...
// ]]></script>';

echo '
</head>


The fix is...
// ]]></script>

<script src="http://www.wowhead.com/widgets/power.js"></script>
<script src="wow/jquery-1.3.2.min.js"></script>
<script src="wow/wowhead_linker.js"></script> ';

echo '
</head>


This code fixed both themes on my test site. If you still have problems let me know.


KillerZ

Garou, I did this and it still seems to do the same thing for the links. All are shown as a light blue color and with no mouseover. Here is my index.template.php just to take a look to make sure it is the same as you have. Thanks for all the help.

<?php
// Version: 1.1.6; index

/* This template is, perhaps, the most important template in the theme. It
contains the main template layer that displays the header and footer of
the forum, namely with main_above and main_below. It also contains the
menu sub template, which appropriately displays the menu; the init sub
template, which is there to set the theme up; (init can be missing.) and
the linktree sub template, which sorts out the link tree.

The init sub template should load any data and set any hardcoded options.

The main_above sub template is what is shown above the main content, and
should contain anything that should be shown up there.

The main_below sub template, conversely, is shown after the main content.
It should probably contain the copyright statement and some other things.

The linktree sub template should display the link tree, using the data
in the $context['linktree'] variable.

The menu sub template should display all the relevant buttons the user
wants and or needs.

For more information on the templating system, please see the site at:
http://www.simplemachines.org/
*/

// Initialize the template... mainly little settings.
function template_init()
{
global $context$settings$options$txt;

/* Use images from default theme when using templates from the default theme?
if this is 'always', images from the default theme will be used.
if this is 'defaults', images from the default theme will only be used with default templates.
if this is 'never' or isn't set at all, images from the default theme will not be used. */
$settings['use_default_images'] = 'never';

/* What document type definition is being used? (for font size and other issues.)
'xhtml' for an XHTML 1.0 document type definition.
'html' for an HTML 4.01 document type definition. */
$settings['doctype'] = 'xhtml';

/* The version this template/theme is for.
This should probably be the version of SMF it was created for. */
$settings['theme_version'] = '1.1.6';

/* Set a setting that tells the theme that it can render the tabs. */
$settings['use_tabs'] = true;

/* Use plain buttons - as oppossed to text buttons? */
$settings['use_buttons'] = true;

/* Show sticky and lock status seperate from topic icons? */
$settings['seperate_sticky_lock'] = true;
}

// The main sub template above the content.
function template_main_above()
{
global $context$settings$options$scripturl$txt$modSettings$boardurl;

// Show right to left and the character set for ease of translating.
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"'
$context['right_to_left'] ? ' dir="rtl"' '''><head>
<!-- WoWHead MouseOver-Tooltip --><script src="http://www.wowhead.com/widgets/power.js" type="text/javascript"></script><!-- /WoWHead MouseOver-Tooltip -->
<meta http-equiv="Content-Type" content="text/html; charset='
$context['character_set'], '" />
<meta name="description" content="'
$context['page_title'], '" />', empty($context['robot_no_index']) ? '' '
<meta name="robots" content="noindex" />'
'
<meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" />
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/script.js?fin11"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "'
$settings['theme_url'], '";
var smf_images_url = "'
$settings['images_url'], '";
var smf_scripturl = "'
$scripturl'";
var smf_iso_case_folding = '
$context['server']['iso_case_folding'] ? 'true' 'false'';
var smf_charset = "'
$context['character_set'], '";
// ]]></script>
<title>'
$context['page_title'], '</title>';

// The ?fin11 part of this link is just here to make sure browsers don't cache it wrongly.
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['theme_url'], '/style.css?fin11" />
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/print.css?fin11" media="print" />';

/* Internet Explorer 4/5 and Opera 6 just don't do font sizes properly. (they are big...)
Thus, in Internet Explorer 4, 5, and Opera 6 this will show fonts one size smaller than usual.
Note that this is affected by whether IE 6 is in standards compliance mode.. if not, it will also be big.
Standards compliance mode happens when you use xhtml... */
if ($context['browser']['needs_size_fix'])
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/fonts-compat.css" />';

// Show all the relative links, such as help, search, contents, and the like.
echo '
<link rel="help" href="'
$scripturl'?action=help" target="_blank" />
<link rel="search" href="' 
$scripturl '?action=search" />
<link rel="contents" href="'
$scripturl'" />';

// If RSS feeds are enabled, advertise the presence of one.
if (!empty($modSettings['xmlnews_enable']))
echo '
<link rel="alternate" type="application/rss+xml" title="'
$context['forum_name'], ' - RSS" href="'$scripturl'?type=rss;action=.xml" />';

// If we're viewing a topic, these should be the previous and next topics, respectively.
if (!empty($context['current_topic']))
echo '
<link rel="prev" href="'
$scripturl'?topic='$context['current_topic'], '.0;prev_next=prev" />
<link rel="next" href="'
$scripturl'?topic='$context['current_topic'], '.0;prev_next=next" />';

// If we're in a board, or a topic for that matter, the index will be the board's index.
if (!empty($context['current_board']))
echo '
<link rel="index" href="' 
$scripturl '?board=' $context['current_board'] . '.0" />';


// We'll have to use the cookie to remember the header...
if ($context['user']['is_guest'])
$options['collapse_header'] = !empty($_COOKIE['upshrink']);

// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'], '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header = '
, empty($options['collapse_header']) ? 'false' 'true'';

function shrinkHeader(mode)
{'
;

// Guests don't have theme options!!
if ($context['user']['is_guest'])
echo '
document.cookie = "upshrink=" + (mode ? 1 : 0);'
;
else
echo '
smf_setThemeOption("collapse_header", mode ? 1 : 0, null, "'
$context['session_id'], '");';

echo '
document.getElementById("upshrink").src = smf_images_url + (mode ? "/upshrink2.gif" : "/upshrink.gif");

document.getElementById("upshrinkHeader").style.display = mode ? "none" : "";

current_header = mode;
}
// ]]></script>'
;

// the routine for the info center upshrink
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header_ic = '
, empty($options['collapse_header_ic']) ? 'false' 'true'';

function shrinkHeaderIC(mode)
{'
;

if ($context['user']['is_guest'])
echo '
document.cookie = "upshrinkIC=" + (mode ? 1 : 0);'
;
else
echo '
smf_setThemeOption("collapse_header_ic", mode ? 1 : 0, null, "'
$context['session_id'], '");';

echo '
document.getElementById("upshrink_ic").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif");

document.getElementById("upshrinkHeaderIC").style.display = mode ? "none" : "";

current_header_ic = mode;
}
// ]]></script>

<script src="http://www.wowhead.com/widgets/power.js"></script>
<script src="wow/jquery-1.3.2.min.js"></script>
<script src="wow/wowhead_linker.js"></script> '
;

     echo '

</head>
<body>
  <div id="container">
<div id="header">
 <div id="head-l">
  <div id="head-r">
 <div id="welcome">'
;
if (!empty($context['user']['avatar']))
 echo '<div id="avatar">'.$context['user']['avatar']['image'].'</div>';
if ($context['user']['is_logged'])
{
echo '<b>'$txt['hello_member'], ' '$context['user']['name'], '</b><br />';

// Only tell them about their messages if they can read their messages!
if ($context['allow_pm'])
echo $txt[152], ' <a href="'$scripturl'?action=pm">'$context['user']['messages'], ' '$context['user']['messages'] != $txt[153] : $txt[471], '</a>'$txt['newmessages4'], ' '$context['user']['unread_messages'], ' '$context['user']['unread_messages'] == $txt['newmessages0'] : $txt['newmessages1'] , '.<br />';
echo '<a href="'$scripturl'?action=unread">'$txt['unread_since_visit'], '</a><br /><a href="'$scripturl'?action=unreadreplies">'$txt['show_unread_replies'], '</a><br />';

}
// Otherwise they're a guest - this time ask them to either register or login - lazy bums...
else
{
echo '
'
$txt['welcome_guest'], '
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/sha1.js"></script>
<form action="'
$scripturl'?action=login2" method="post" accept-charset="'$context['character_set'], '" style="margin: 4px 0;"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' $context['session_id'] . '\');"' '''>
<input type="text" name="user"  size="10" />
<input type="password" name="passwrd"  size="10" />
<input type="submit" value="'
$txt[34], '" />
<input type="hidden" name="hash_passwrd" value="" />
</form>'
$txt['smf52'], '<br /><br />';
}
echo '
 </div>'
;
echo '
<a href="'
.$scripturl.'" title=""><span id="logo"> </span></a>';
echo '
</div>
  </div>
 </div>
<div class="catbg">
  '
template_menu(), '
  </div>
 <div id="main-l">
  <div id="main-r">
<div id="mainarea">'
;
}

function 
template_main_below()
{
global $context$settings$options$scripturl$txt$user_info;

  echo '
</div>
</div>
</div>
 <div id="footer">
  <div id="footer-left">
 <div id="footer-right">
  <div id="footerarea" style="font-size: smaller;">
 '
theme_copyright(), '
 <br />IronWoW by <a href="http://www.jpr62.com/theme/index.php"><b>Crip</b></a><br /><i>All images are proprieties of their respective owners ( <a href="http://www.blizzard.com/us/">Blizzard Entertainment</a></i> )</div>'
;

// Show the load time?
if ($context['show_load_time'])
echo ''$txt['smf301'], $context['load_time'], $txt['smf302'], $context['load_queries'], $txt['smf302b'];

echo '
  </div>
  </div>
  </div>'
;
echo '
</div> 
</body></html>'
;
}

// Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree()
{
global $context$settings$options;

echo '<div class="nav" style="font-size: smaller; margin-bottom: 2ex; margin-left: 1ex; margin-top: 2ex;">';

// Each tree item has a URL and name. Some may have extra_before and extra_after.
foreach ($context['linktree'] as $link_num => $tree)
{
// Show something before the link?
if (isset($tree['extra_before']))
echo $tree['extra_before'];

// Show the link, including a URL if it should have one.
echo '<b>'$settings['linktree_link'] && isset($tree['url']) ? '<a href="' $tree['url'] . '" class="nav">' $tree['name'] . '</a>' $tree['name'], '</b>';

// Show something after the link...?
if (isset($tree['extra_after']))
echo $tree['extra_after'];

// Don't show a separator for the last one.
if ($link_num != count($context['linktree']) - 1)
echo ' &raquo; ';
}

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 '
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>'
;

// Show the [home] button.
echo '
<td class="mainnav"><a href="'
$scripturl'">' $txt[103] , '</a></td>';

// Show the [Forum] button.
echo '
<td class="mainnav"><a href="'
$scripturl'?action=forum"><span>Forum<span></a></td>';

// How about the [Gallery] button?
if ($context['allow_search'])
echo '
<td class="mainnav"><a href="'
$scripturl'?action=gallery"><span>Gallery<span></a></td>';

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

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '
<td class="mainnav"><a href="'
$scripturl'?action=profile">' $txt[79] , '</a></td>';

// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo '
<td class="mainnav"><a href="'
$scripturl'?action=pm">' $txt['pm_short'] , ' '$context['user']['unread_messages'] > '[<strong><blink>'$context['user']['unread_messages'] . '</blink></strong>]' '' '</a></td>';

// The [calendar]!
if ($context['allow_calendar'])
echo '
<td class="mainnav"><a href="'
$scripturl'?action=calendar">' $txt['calendar24'] , '</a></td>';

// the [member] list button
if ($context['allow_memberlist'])
echo '
<td class="mainnav"><a href="'
$scripturl'?action=mlist">' $txt[331] , '</a></td>';

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


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


// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo '
<td class="mainnav"><a href="'
$scripturl'?action=logout;sesc='$context['session_id'], '">' $txt[108] , '</a>
  </td>'
;

// The end of tab section.
echo '
</tr>
</table><div style="clear:both;">
 </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>&nbsp;</td>';

echo '
<td class="maintab_back">'
implode(''$button_strip) , '</td>';
}

?>

Garou

That looks right

I forget does the mod work on the default them for you or not?

Here is the code exactly as it is on my test site.
<?php
// Version: 1.1.6; index

/* This template is, perhaps, the most important template in the theme. It
contains the main template layer that displays the header and footer of
the forum, namely with main_above and main_below. It also contains the
menu sub template, which appropriately displays the menu; the init sub
template, which is there to set the theme up; (init can be missing.) and
the linktree sub template, which sorts out the link tree.

The init sub template should load any data and set any hardcoded options.

The main_above sub template is what is shown above the main content, and
should contain anything that should be shown up there.

The main_below sub template, conversely, is shown after the main content.
It should probably contain the copyright statement and some other things.

The linktree sub template should display the link tree, using the data
in the $context['linktree'] variable.

The menu sub template should display all the relevant buttons the user
wants and or needs.

For more information on the templating system, please see the site at:
http://www.simplemachines.org/
*/

// Initialize the template... mainly little settings.
function template_init()
{
global $context$settings$options$txt;

/* Use images from default theme when using templates from the default theme?
if this is 'always', images from the default theme will be used.
if this is 'defaults', images from the default theme will only be used with default templates.
if this is 'never' or isn't set at all, images from the default theme will not be used. */
$settings['use_default_images'] = 'never';

/* What document type definition is being used? (for font size and other issues.)
'xhtml' for an XHTML 1.0 document type definition.
'html' for an HTML 4.01 document type definition. */
$settings['doctype'] = 'xhtml';

/* The version this template/theme is for.
This should probably be the version of SMF it was created for. */
$settings['theme_version'] = '1.1.6';

/* Set a setting that tells the theme that it can render the tabs. */
$settings['use_tabs'] = true;

/* Use plain buttons - as oppossed to text buttons? */
$settings['use_buttons'] = true;

/* Show sticky and lock status seperate from topic icons? */
$settings['seperate_sticky_lock'] = true;
}

// The main sub template above the content.
function template_main_above()
{
global $context$settings$options$scripturl$txt$modSettings$boardurl;

// Show right to left and the character set for ease of translating.
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"'
$context['right_to_left'] ? ' dir="rtl"' '''><head>
<meta http-equiv="Content-Type" content="text/html; charset='
$context['character_set'], '" />
<meta name="description" content="'
$context['page_title'], '" />', empty($context['robot_no_index']) ? '' '
<meta name="robots" content="noindex" />'
'
<meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" />
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/script.js?fin11"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "'
$settings['theme_url'], '";
var smf_images_url = "'
$settings['images_url'], '";
var smf_scripturl = "'
$scripturl'";
var smf_iso_case_folding = '
$context['server']['iso_case_folding'] ? 'true' 'false'';
var smf_charset = "'
$context['character_set'], '";
// ]]></script>
<title>'
$context['page_title'], '</title>';

// The ?fin11 part of this link is just here to make sure browsers don't cache it wrongly.
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['theme_url'], '/style.css?fin11" />
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/print.css?fin11" media="print" />';

/* Internet Explorer 4/5 and Opera 6 just don't do font sizes properly. (they are big...)
Thus, in Internet Explorer 4, 5, and Opera 6 this will show fonts one size smaller than usual.
Note that this is affected by whether IE 6 is in standards compliance mode.. if not, it will also be big.
Standards compliance mode happens when you use xhtml... */
if ($context['browser']['needs_size_fix'])
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/fonts-compat.css" />';

// Show all the relative links, such as help, search, contents, and the like.
echo '
<link rel="help" href="'
$scripturl'?action=help" target="_blank" />
<link rel="search" href="' 
$scripturl '?action=search" />
<link rel="contents" href="'
$scripturl'" />';

// If RSS feeds are enabled, advertise the presence of one.
if (!empty($modSettings['xmlnews_enable']))
echo '
<link rel="alternate" type="application/rss+xml" title="'
$context['forum_name'], ' - RSS" href="'$scripturl'?type=rss;action=.xml" />';

// If we're viewing a topic, these should be the previous and next topics, respectively.
if (!empty($context['current_topic']))
echo '
<link rel="prev" href="'
$scripturl'?topic='$context['current_topic'], '.0;prev_next=prev" />
<link rel="next" href="'
$scripturl'?topic='$context['current_topic'], '.0;prev_next=next" />';

// If we're in a board, or a topic for that matter, the index will be the board's index.
if (!empty($context['current_board']))
echo '
<link rel="index" href="' 
$scripturl '?board=' $context['current_board'] . '.0" />';


// We'll have to use the cookie to remember the header...
if ($context['user']['is_guest'])
$options['collapse_header'] = !empty($_COOKIE['upshrink']);

// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'], '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header = '
, empty($options['collapse_header']) ? 'false' 'true'';

function shrinkHeader(mode)
{'
;

// Guests don't have theme options!!
if ($context['user']['is_guest'])
echo '
document.cookie = "upshrink=" + (mode ? 1 : 0);'
;
else
echo '
smf_setThemeOption("collapse_header", mode ? 1 : 0, null, "'
$context['session_id'], '");';

echo '
document.getElementById("upshrink").src = smf_images_url + (mode ? "/upshrink2.gif" : "/upshrink.gif");

document.getElementById("upshrinkHeader").style.display = mode ? "none" : "";

current_header = mode;
}
// ]]></script>'
;

// the routine for the info center upshrink
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header_ic = '
, empty($options['collapse_header_ic']) ? 'false' 'true'';

function shrinkHeaderIC(mode)
{'
;

if ($context['user']['is_guest'])
echo '
document.cookie = "upshrinkIC=" + (mode ? 1 : 0);'
;
else
echo '
smf_setThemeOption("collapse_header_ic", mode ? 1 : 0, null, "'
$context['session_id'], '");';

echo '
document.getElementById("upshrink_ic").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif");

document.getElementById("upshrinkHeaderIC").style.display = mode ? "none" : "";

current_header_ic = mode;
}
// ]]></script>

 <script src="http://www.wowhead.com/widgets/power.js"></script>
<script src="wow/jquery-1.3.2.min.js"></script>
<script src="wow/wowhead_linker.js"></script> '
;

echo '
</head>
</head>
<body>
  <div id="container">
<div id="header">
 <div id="head-l">
  <div id="head-r">
 <div id="welcome">'
;
if (!empty($context['user']['avatar']))
 echo '<div id="avatar">'.$context['user']['avatar']['image'].'</div>';
if ($context['user']['is_logged'])
{
echo '<b>'$txt['hello_member'], ' '$context['user']['name'], '</b><br />';

// Only tell them about their messages if they can read their messages!
if ($context['allow_pm'])
echo $txt[152], ' <a href="'$scripturl'?action=pm">'$context['user']['messages'], ' '$context['user']['messages'] != $txt[153] : $txt[471], '</a>'$txt['newmessages4'], ' '$context['user']['unread_messages'], ' '$context['user']['unread_messages'] == $txt['newmessages0'] : $txt['newmessages1'] , '.<br />';
echo '<a href="'$scripturl'?action=unread">'$txt['unread_since_visit'], '</a><br /><a href="'$scripturl'?action=unreadreplies">'$txt['show_unread_replies'], '</a><br />';

}
// Otherwise they're a guest - this time ask them to either register or login - lazy bums...
else
{
echo '
'
$txt['welcome_guest'], '
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/sha1.js"></script>
<form action="'
$scripturl'?action=login2" method="post" accept-charset="'$context['character_set'], '" style="margin: 4px 0;"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' $context['session_id'] . '\');"' '''>
<input type="text" name="user"  size="10" />
<input type="password" name="passwrd"  size="10" />
<input type="submit" value="'
$txt[34], '" />
<input type="hidden" name="hash_passwrd" value="" />
</form>'
$txt['smf52'], '<br /><br />';
}
echo '
 </div>'
;
echo '
<a href="'
.$scripturl.'" title=""><span id="logo"> </span></a>';
echo '
</div>
  </div>
 </div>
<div class="catbg">
  '
template_menu(), '
  </div>
 <div id="main-l">
  <div id="main-r">
<div id="mainarea">'
;
}

function 
template_main_below()
{
global $context$settings$options$scripturl$txt$user_info;

  echo '
</div>
</div>
</div>
 <div id="footer">
  <div id="footer-left">
 <div id="footer-right">
  <div id="footerarea" style="font-size: smaller;">
 '
theme_copyright(), '
 <br />IronWoW by <a href="http://www.jpr62.com/theme/index.php"><b>Crip</b></a><br /><i>All images are proprieties of their respective owners ( <a href="http://www.blizzard.com/us/">Blizzard Entertainment</a></i> )</div>'
;

// Show the load time?
if ($context['show_load_time'])
echo ''$txt['smf301'], $context['load_time'], $txt['smf302'], $context['load_queries'], $txt['smf302b'];

echo '
  </div>
  </div>
  </div>'
;
echo '
</div> 
</body></html>'
;
}

// Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree()
{
global $context$settings$options;

echo '<div class="nav" style="font-size: smaller; margin-bottom: 2ex; margin-left: 1ex; margin-top: 2ex;">';

// Each tree item has a URL and name. Some may have extra_before and extra_after.
foreach ($context['linktree'] as $link_num => $tree)
{
// Show something before the link?
if (isset($tree['extra_before']))
echo $tree['extra_before'];

// Show the link, including a URL if it should have one.
echo '<b>'$settings['linktree_link'] && isset($tree['url']) ? '<a href="' $tree['url'] . '" class="nav">' $tree['name'] . '</a>' $tree['name'], '</b>';

// Show something after the link...?
if (isset($tree['extra_after']))
echo $tree['extra_after'];

// Don't show a separator for the last one.
if ($link_num != count($context['linktree']) - 1)
echo ' &raquo; ';
}

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 '
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>'
;

// Show the [home] button.
echo '
<td class="mainnav"><a href="'
$scripturl'">' $txt[103] , '</a></td>';

// Show the [help] button.
echo '
<td class="mainnav"><a href="'
$scripturl'?action=help">' $txt[119] , '</a></td>';

// How about the [search] button?
if ($context['allow_search'])
echo '
<td class="mainnav"><a href="'
$scripturl'?action=search">' $txt[182] , '</a></td>';

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

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '
<td class="mainnav"><a href="'
$scripturl'?action=profile">' $txt[79] , '</a></td>';

// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo '
<td class="mainnav"><a href="'
$scripturl'?action=pm">' $txt['pm_short'] , ' '$context['user']['unread_messages'] > '[<strong><blink>'$context['user']['unread_messages'] . '</blink></strong>]' '' '</a></td>';

// The [calendar]!
if ($context['allow_calendar'])
echo '
<td class="mainnav"><a href="'
$scripturl'?action=calendar">' $txt['calendar24'] , '</a></td>';

// the [member] list button
if ($context['allow_memberlist'])
echo '
<td class="mainnav"><a href="'
$scripturl'?action=mlist">' $txt[331] , '</a></td>';

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


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


// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo '
<td class="mainnav"><a href="'
$scripturl'?action=logout;sesc='$context['session_id'], '">' $txt[108] , '</a>
  </td>'
;

// The end of tab section.
echo '
</tr>
</table><div style="clear:both;">
 </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>&nbsp;</td>';

echo '
<td class="maintab_back">'
implode(''$button_strip) , '</td>';
}

?>


And a SS of it working is attached.

Note that I am using fopen on my test site but it was also tested on a site that does use libcurl without any problems.

If this code doesn't work and the mod doesn't work on the default theme then my next guess is that your host doesn't have fopen on or libcurl on the server. I know many hosts have reservations about fopen but most of them at least trust curl and libcurl. Contact them and ask about it and point them to http://curl.haxx.se/

KillerZ

Quote from: Garou on March 31, 2009, 11:54:18 AM
I forget does the mod work on the default them for you or not?

No, when I installed it there was an error with the install into the default/index.template.php. I checked the file and the code had not been put in there. I would assume this would mean it wouldn't work on there. actually there is a code in the place where this should be for the wow character profiles mod. Should I try adding the tooltips lines after that just to see if it will work on the default theme? Thanks again for all the help. I am starting to think though that the server just doesn't have the necessary stuff on it to run it. Hopefully the host will cooperate with getting it going if it isn't.

Garou

Yeah that's exactly where they would go, you could even put them just before and it should be fine.

If the mod doesn't work on the default theme after that, then its definite that your host doesn't have fopen or libcurl on the server. I'm pretty sure at this point they do not. I'm not sure who your host is or what type of server your on but they should be willing to work with you.

Daehoidar

Hi

First sorry for my english.

Is there anyway to use this mod with items in spanish?


Nana23

the wow BBS dont work fine at my page

hxxp:inrage-guild.com/index.php?topic=5.msg5#msg5 [nonactive]

Color dont work right and no tool tip shown

Garou

Daehoidar, I haven't tested any other languages but it should work.

In wowhead_wrapper.php find...
header("Content-type: text/xml");
$url = "http://www.wowhead.com/?item=".urlencode(addslashes($_GET['item']))."&xml";


And replace with...
header("Content-type: text/xml");
$url = "http://es.wowhead.com/?item=".urlencode(addslashes($_GET['item']))."&xml";


This should also work for other languages Wowhead supports as well. However they say
QuoteLocalized links (requires your site to use UTF-8 encoding)

Nana23, from what I can see form the outside everything looks like it's set up correctly, so I'm going to guess that your web host does not support either fopen or curl. You'll have to contact them about that. Sorry  :(

tattooedpierre

I'm having a strange problem whereby item links are coloured but not popping up on mouseover, and they also do not link back to wowhead when clicked on. It installed no issues via package manager; I also checked via phpinfo() and both libcurl and fopen are enabled.

Any ideas? I dont believe it should affect it, but my board is also running SimplePortal.

Garou

#19
I tested with and with out SP and it works fine.

The mod runs on my test server, which has fopen enabled but not libcurl. I've instaled on another server that has libcurl but not fopen and it runs fine.  It also ran the SMF tested it on before they approved it.

That said I'm currently working on another server that also has libcurl and fopen enabled but the mod isn't working. I'm looking into it and I'm convinced that there are other server settings required that I have on my test server that some servers do not. Once I figure it out ill include the instructions here and in the mod.

In the meantime all I can say is that this mod may not work on all servers. I wish I had a better answer but I haven't found it yet.

Advertisement: