Author Topic: EZPortal - ezBlocks -> PHPBlock -> PHP Syntax Error  (Read 1094 times)

0 Members and 1 Guest are viewing this topic.

Offline brickerz

  • New Member
  • *
  • Posts: 1
  • Karma: 0
  • SMF Version: 2.0 RC3
EZPortal - ezBlocks -> PHPBlock -> PHP Syntax Error
« on: May 02, 2010, 10:14:44 AM »
I've just started into SMF and began modifying and designing a site around it for gaming. (Yes, it's WoW)  I was screwing around with EZPortal because it seemed the most user friendly, with the least amount of bloat yet all the features I still desired in a portal software but came across a rather troubling problem with the PHPBlock.  I've posted on EZPortal's website as well and received some help but still to no avail, the block does not work.

Here is the code I am trying to use.  It's from TinyPortal, however I assumed, and perhaps wrongly, that PHP was PHP in terms of how a block or portal software would parse and manage the code.  It has worked on TP when  I installed that in a test board to just see if it worked.

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

So where it stands is the PHP appears to be fine, and now I'm looking at either a problem with SMF, a problem on my server possibly with the php configuration, or perhaps ezportal cannot handle php in its phpblocks like it should.  Hence, why I'm here.  Hopefully I can get this resolved and release something that will work for that portal.  As sad as it is, WoW based addons help build software because of the vast amount of people that play the game and are building sites etc.
Thanks in advance for any help you can provide, even if it's just a "you'll have to wait it out with EZPortal".

Offline bigguy

  • Site Owner
  • Administrator
  • *
  • Posts: 13225
  • Karma: 269
  • Gender: Male
  • Get'r Done
    • P.C. Tweakr
  • SMF Version: 2.0 Gold
Re: EZPortal - ezBlocks -> PHPBlock -> PHP Syntax Error
« Reply #1 on: May 10, 2010, 10:14:36 PM »
Did you read this and make sure it is loaded in that block as well:

// Requires wz_tooltip to be loaded in the page