PDA

View Full Version : adv_portal_ibparcade



zdig1
11-21-2013, 11:31 AM
finally i decide to upgrade from vb3.8 to vb4 but i get many work to do
searching the new or similar version of my old hack and trying to do the transation

i get some error on an old module based on an ibproracade (random not ajax)


Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: adv_portal_ibparcade in [path]/includes/functions.php on line 4591
any body knoiw the chnage we have to do to let this work with the new vb 4 ( template and variable)

it use 1 template and 1 file

template adv_portal_ibparcade


<tr><td class="alt1" width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td>$out</td></tr></table></td></tr>


file ibparcade_game.php

<?php
/* -----------------10/24/2005 5:38PM----------------
IbPro Game Block 1.0 - CMPS 2.0 (VB 3.5)
Zachariah - http://www.gzhq.net
Tested on:
- vBulletin 3.5.0
- ibProArcade v2.5.1 (vB 3.5)
- vBadvanced CMPS v2.0.0 (vB 3.5)
--------------------------------------------------*/
/* ### EDIT OPTIONS #########################################################*/
/* Set number of games to show */
$gamecount = 1;

// Enter 1 newest, 2 most played, 3 highest rated, 4 random.
$gameorder = 4;

/* Path to arcade images */
$path = "/vb/arcade/images/"; //---> Do not forget the '/' --->

/* ################################################# NO EDIT NEEDED BELOW ###*/

/* Reset Array's */
$game_info_gid = array();
$game_info_gname = array();
$game_info_gtitle = array();
$game_info_gwords = array();

switch ($gameorder)
{
case 2:
$gorderby = 'gcount DESC';
break;
case 3:
$gorderby = 'g_rating DESC';
break;
case 4:
$gorderby = 'RAND()';
break;
default:
$gorderby = 'gid DESC';
}

/* Get game info by game title */
for ($x = 0 ; $x < $gamecount ; $x++)
{
$game = $db->query(
"SELECT gid, gname, gcount, gtitle, g_rating, gwords, added FROM
" . TABLE_PREFIX . "games_list WHERE active='1' ORDER BY $gorderby LIMIT ".$gamecount
);
while($print_row = $db->fetch_array($game))
{
/* Add to game info array */
array_push($game_info_gid, $print_row['gid']);
array_push($game_info_gname, $print_row['gname']);
array_push($game_info_gtitle, $print_row['gtitle']);
array_push($game_info_gwords, $print_row['gwords']);

}
}

/* Clean up */
$db->free_result($game);

/* Build Output */
$out = "";
for ($x = 0 ; $x < $gamecount ; $x++)
{
$out .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n";
$out .= " <tr>\n";
$out .= " <td><div align=\"center\">Play this game now!</div></td>\n";
$out .= " </tr>\n";
$out .= " <tr>\n";
$out .= " <tr>\n";
$out .= " <td><br></td>\n";
$out .= " </tr>\n";

$out .= " <td width=\"1%\" valign=\"top\" class=\"alt1\"><div align=\"center\"><img src=\"".$path.$game_info_gname[$x]."1.gif\" border=\"0\"></div></td>\n";
$out .= " </tr>\n";
$out .= " <tr>\n";
$out .= " <td><br></td>\n";
$out .= " </tr>\n";
$out .= " <tr>\n";
$out .= " <td><div align=\"center\"><a href=\"".$vbulletin->options['bburl']."/arcade.php?act=Arcade&do=play&gameid=".$game_info_gid[$x]."\" target=\"_self\"><strong>".$game_info_gtitle[$x]."</strong></a></div></td>\n";
$out .= " </tr>\n";
$out .= "\n";
$out .= "</table>\n";
if($x < $gamecount -1) { $out .= "<hr>\n"; }
}

/* Do Template */
eval('$home["$mods[modid]"][\'content\'] = "' . fetch_template('adv_portal_ibparcade') . '";');

/* Clean up */
$out = NULL;
?>

zdig1
11-21-2013, 12:06 PM
i found the probleme but not the solution :

eval('$home["$mods[modid]"][\'content\'] = "' . fetch_template('adv_portal_ibparcade') . '";');
we have to replace the fetch one by template class
i was nice in vb 3 code
but on vb4 it is very new for me
any help ?

Our Sponsors
 

zdig1
11-25-2013, 03:16 PM
no one can help me ??

Brian
12-12-2013, 04:32 PM
The PHP code would need to look something more like this, though you'll likely need to modify the HTML code as well to match vB4.

$templater = vB_Template::create('adv_portal_ibparcade');
$templater->register('out', $out);
$home["$mods[modid]"]['content'] = $templater->render();