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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,911
  • Total Topics: 21,307
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 405
  • Total: 405

World of Warcraft Recruitment Block

Started by Moocat, October 31, 2007, 08:36:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Raugturi

#30
I've never written much PHP so I decided to try this with arrays and foreach loops rather than a function, mostly just to see if I could.  So, if anyone is interested in it (or has any advice or critiques) I thought I would share:

// SMF-TinyPortal WoW Recruitment Block - ver. 0.5

// Author: Raugturi (Raugturi@gmail.com)
// Created: April 01, 2009
// Last Update: April 02, 2009

// Code to display list of classes for WoW along with current
// recruitment status (Closed, Low, Medium and High) and gives
// specific specs/number needed in Tooltip.
//
// Requires wz_tooltip to be loaded in the page
// http://www.walterzorn.com/tooltip/tooltip_e.htm

// ******************
// * Config Section *
// ******************

// Recruitment Page: Path to Recruitment page
$recruitment_page = 'index.php?board=2.0';

// Image Directory: Path to icon folder
// Note: Must contain trailing '/'
$icon_dir = 'images/';

// Status Colors: Set the color for each status here.
$closed_color = '#8B0000';
$low_color = '#FF4500';
$medium_color = '#FF8C00';
$high_color = '#006400';

// Class Arrays
// Variables:
// Name   - Type: Text,    Value: Class name
// Status - Type: Integer, Value: 0=closed, 1=low, 2=medium, 3=high
// Icon   - Type: Text,    Value: Name of class icon image
// Specs  - Type: Array,   Element Format: Key = Spec, Value = Number Need (ex. 'DPS' => 1)
$classlist = array(
array(
'name' => 'Emo Noobs',
'status' => 0,
'icon' => 'emo_noob.gif',
'specs' => array('\/wrists' => '<<u>^^^</u>\}==\]...\[==\{<u>^^^</u>> (sword-chuks)')),
array(
'name' => 'Death Knight',
'status' => 1,
'icon' => 'dk_icon.gif',
'specs' => array('DPS' => 1,'Tank' => 0)),
array(
'name' => 'Druid',
'status' => 2,
'icon' => 'druid_icon.gif',
'specs' => array('Balance' => 1, 'Feral' => 0, 'Resto' => 1)),
array(
'name' => 'Hunter',
'status' => 1,
'icon' => 'hunter_icon.gif',
'specs' => array('Any' => 1)),
array(
'name' => 'Mage',
'status' => 1,
'icon' => 'mage_icon.gif',
'specs' => array('Any' => 1)),
array(
'name' => 'Paladin',
'status' => 3,
'icon' => 'paladin_icon.gif',
'specs' => array('Holy' => 2, 'Prot' => 1, 'Ret' => 1)),
array(
'name' => 'Priest',
'status' => 2,
'icon' => 'priest_icon.gif',
'specs' => array('Disc' => 1, 'Holy' => 1, 'Shadow' => 0)),
array(
'name' => 'Rogue',
'status' => 1,
'icon' => 'rogue_icon.gif',
'specs' => array('Any' => 1)),
array(
'name' => 'Shaman',
'status' => 3,
'icon' => 'shaman_icon.gif',
'specs' => array('Enhancement' => 1, 'Elemental' => 1, 'Restoration' => 1)),
array(
'name' => 'Warlock',
'status' => 2,
'icon' => 'warlock_icon.gif',
'specs' => array('Any' => 2)),
array(
'name' => 'Warrior',
'status' => 2,
'icon' => 'warrior_icon.gif',
'specs' => array('DPS' => 1, 'Prot' => 1)
));

//**********************
//* END Config Section *
//**********************

//*********************************
//* Do not edit below here unless *
//* you know what you are doing!! *
//*********************************

echo '
<table width="100%">';

foreach ($classlist as $class) {

switch ($class['status']) {
case 0:
$status = '<font color="' . $closed_color . '">Closed</font>';
break;
case 1:
$status = '<font color="' . $low_color . '">Low</font>';
break;
case 2:
$status = '<font color="' . $medium_color . '">Medium</font>';
break;
case 3:
$status = '<font color="' . $high_color . '">High</font>';
break;
}

$tooltip = '<table width=100% cellpadding=0 cellspacing=0>';

foreach ($class['specs'] as $key => $value) {
$tooltip = $tooltip . '<tr><td>' . $key . ': </td><td width=5px>&nbsp;</td><td align=right>' . $value . '</td></tr>';
}

$tooltip = $tooltip . '</table>';

echo '
  <tr>
    <td><img src="' . $icon_dir . $class['icon'] . '"> ' . $class['name'] . '</td>
    <td align="right"><a style="text-decoration: none;" href="javascript:void(0);" onmouseover="Tip(\'' . $tooltip . '\')" onmouseout="UnTip()">' . $status . '</a></td>
  </tr>';

}

echo '
  <tr>
    <td align="center" colspan=2>
      <a href="' . $recruitment_page . '">Apply Here</a>
  <hr />
  <font size="-2">Mouseover status<br />for details.</font>
    </td>
  </tr>
</table>
';

Ken.

Welcome to TinyPortal Raugturi.
Thanks for sharing. :up:
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

Inny

i like your emo noobs idea :P

Gonna give it a try when i get home and get back to you.

Raugturi

Thank you Ken.

Quote from: Inny on April 02, 2009, 01:33:12 PM
i like your emo noobs idea :P

Gonna give it a try when i get home and get back to you.
I completely forgot that I left that in there.  Glad you like it. :)

garou

I like it, it cleans the original idea up a bit. Something Moocat asked to be done originally anyway.

I might change
href="#"
back to
href="javascript:void(0);"

It's just a personal preference.

None the less it works well and the emo noobs is a nice touch.  :laugh:

Raugturi

Yeah, I copied that part from another section and didn't even think about it, but I agree that the javascript:void(0); is better.  Updated script to use it instead.  Thanks.

Kazie

Okay so i can't make the wz_tooltip work.. exactly where shall i put the files, and what line in what shall i put the loading script?

So far i tried putting the wz_tooltip folder inside theme folders, then the root forum directory..

Both times with the loading script here in the index.template.php file:

</head>
<body>
<script type="text/javascript" src="wz_tooltip.js"></script> 


Since it said on the website, to put it there.. but i am clearly messing up something since the tooltip ain't working :)

garou

#37
Drop I had to do was drop the scripts in \forum\scripts\wz_tooltip and popped the code in a block. I didn't modify the template at all.

That said Im also using nitebree's WoW Character Profiles that uses overlib.js so it could be possible its using that instead. *shrug*

If nothing else works for you I usually put javascript calls like that before the end header tag. Try...

<script type="text/javascript" src="wz_tooltip.js"></script>
</head>
<body>


Kazie

Quote from: garou on April 13, 2009, 03:59:59 PM
Drop I had to do was drop the scripts in \forum\scripts\wz_tooltip and popped the code in a block. I didn't modify the template at all.

That said Im also using nitebree's WoW Character Profiles that uses overlib.js so it could be possible its using that instead. *shrug*

If nothing else works for you I usually put javascript calls like that before the end header tag. Try...

<script type="text/javascript" src="wz_tooltip.js"></script>
</head>
<body>



I don't have any scripts folder :s should i just make it manually or is it something your other stuff made for you?

garou

That is something I made as I have a few other scripts on my site and that way I can keep them together.

This website is proudly hosted on Crocweb Cloud Website Hosting.