EzPortal - Portal Software for Forums

EzPortal - Made to Fit Your SMF Forum - Glad You Found Us!
+- +-

UserBox

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Recent Posts

New built in translations for six langauges! by EzPortal
March 26, 2024, 11:15:32 pm

Smiley missing in shoutbox 2.1.4 by hustreamload
July 26, 2023, 08:14:02 am

Re: Theme Select Box question? by Shades
March 15, 2023, 06:49:49 pm

Re: Theme Select Box question? by Shades
March 09, 2023, 02:09:24 pm

Re: Theme Select Box question? by Shades
March 09, 2023, 01:55:53 pm

Re: Theme Select Box question? by EzPortal
March 09, 2023, 01:47:42 pm

Re: Theme Select Box question? by Shades
March 09, 2023, 01:34:07 pm

Re: Theme Select Box question? by EzPortal
March 09, 2023, 12:20:17 pm

+- HTML Menu


Sample HTML Block Usage - You May Custom Code it, as needed!

Recent Topics ezBlock

New built in translations for six langauges! by EzPortal
March 26, 2024, 11:15:32 pm

Smiley missing in shoutbox 2.1.4 by hustreamload
July 26, 2023, 08:14:02 am

Theme Select Box question? by Shades
March 15, 2023, 06:49:49 pm

Where is the facebook button color? by EzPortal
February 28, 2023, 06:45:09 pm

Display on Mobile - SMF 2.1.3 and EZ 5.5.2 by BugginIn
December 29, 2022, 04:07:13 pm

Blocks Help by Riggs1973
November 20, 2022, 12:59:30 pm

Surface ol lite theme release Free! by Steffen K.
November 18, 2022, 03:57:24 am

Undefined index: href by EzPortal
October 04, 2022, 08:49:59 pm

SMF-ezportal_column_5.cache): failed to open stream: No such file or directory by EzPortal
June 04, 2022, 11:40:13 am

Arcade block error: failed to open stream: No such file or directory by Shades
May 20, 2022, 02:47:13 pm

Author Topic: PHPBlock Syntax Error  (Read 10265 times)

0 Members and 1 Guest are viewing this topic.

Offline brickerz

  • Posts: 6
  • Karma: 0
PHPBlock Syntax Error
« on: May 01, 2010, 05:36:27 pm »
I was looking for a recruitment block for warcraft and found one over at tinyportal that uses the PHP block.  I think I may have wrongfully assumed that PHP interpretation was universal, as it works under TP, but not under EZP.  

Code: [Select]
<?php
// 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>
;'
?>


I've tried it with and without the php tags, and can't find any sort of syntax error in here that would cause EZP to kick it back.

Offline EzPortal

  • Administrator
  • *****
  • Posts: 1299
  • Karma: 67
Re: PHPBlock Syntax Error
« Reply #1 on: May 01, 2010, 05:37:42 pm »
Your missing a '; in the end
use this

Code: [Select]
// 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>';
Like ezPortal? Support me at https://www.patreon.com/vbgamer45/

Offline brickerz

  • Posts: 6
  • Karma: 0
Re: PHPBlock Syntax Error
« Reply #2 on: May 01, 2010, 05:58:34 pm »
I was missing it initially but went back and corrected it in an edit.  However, it still throws a syntax error and I can't figure out what the error is.  My only thought was the wz_tooltip.js issue but I have tried it in root, scripts, smf root, basically everywhere I can think of.

www.mydisorganizedmind.com/smf < should be visible to normal users.  I tried using firebug and firephp to determine the error it's throwing but it doesn't appear to show.

Offline EzPortal

  • Administrator
  • *****
  • Posts: 1299
  • Karma: 67
Re: PHPBlock Syntax Error
« Reply #3 on: May 01, 2010, 06:04:51 pm »
Use my above code even in the sample above you have ;' instead of ';
Like ezPortal? Support me at https://www.patreon.com/vbgamer45/

Offline brickerz

  • Posts: 6
  • Karma: 0
Re: PHPBlock Syntax Error
« Reply #4 on: May 01, 2010, 06:32:00 pm »
I just tried the code, same php syntax error box.  I'm trying to think of what else it could be and am coming up with nothing.

Offline EzPortal

  • Administrator
  • *****
  • Posts: 1299
  • Karma: 67
Re: PHPBlock Syntax Error
« Reply #5 on: May 01, 2010, 06:35:14 pm »
There were multiple errors with that code posted a fixed one here
Code: [Select]
// 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>';
Like ezPortal? Support me at https://www.patreon.com/vbgamer45/

Offline brickerz

  • Posts: 6
  • Karma: 0
Re: PHPBlock Syntax Error
« Reply #6 on: May 01, 2010, 06:57:49 pm »
First: Thank you for the help.  This isn't your code, nor your problem per se and I appreciate the assistance.  
Second: Unfortunately, it still doesn't work.  Is there anything aside from the php code that could be causing the error on my end with the php configuration on the server?

Thank you again!

[e1] Do you think it has anything to do with using SMF 2.0RC3?

Offline brickerz

  • Posts: 6
  • Karma: 0
Re: PHPBlock Syntax Error
« Reply #7 on: May 02, 2010, 09:14:35 pm »
I actually tried several other themes to try and figure out if that was the problem.  Were you guys able to get the script to run successfully on a version of ezportal?

Offline brickerz

  • Posts: 6
  • Karma: 0
Re: PHPBlock Syntax Error
« Reply #8 on: May 02, 2010, 09:46:36 pm »
I also took your advice and ran a check on the syntax by installing PHP onto my box and using rapid PHP, there are no syntax errors with php5.3.2 which is what I'm running on the host.  I really have nowhere else to go with this, except switching to TinyPortal which is not what i had wanted but it seems that it's the easiest thing and the script works on that package.

 

Related Topics

  Subject / Started by Replies Last post
Error?

Started by chinaren Bugs

2 Replies
11279 Views
Last post December 07, 2008, 01:31:02 am
by chinaren
1 Replies
7746 Views
Last post December 08, 2008, 06:51:34 pm
by EzPortal
5 Replies
8088 Views
Last post February 05, 2009, 10:47:16 am
by BigJon
Error

Started by Rocko Support

1 Replies
6091 Views
Last post January 05, 2009, 07:46:37 pm
by EzPortal
9 Replies
11860 Views
Last post May 04, 2009, 04:00:39 am
by Marian

+-SMF Gallery

Quick Menu


Powered by EzPortal