SimplePortal

Customization => Custom Coding => Topic started by: 420connect on March 20, 2015, 12:32:34 PM

Title: SMF Arcade - Random games block
Post by: 420connect on March 20, 2015, 12:32:34 PM
Hey all,

I'm trying to add a block of random games to SP with an old code I've found..

It works as expected but when I have the block enabled, the blocks below it have database error messages showing /blocks are missing..

Would anyone mind having a look over this code to see if it's missing something obvious to end the script of something?

Many thanks!

Code: [Select]
global $db_prefix, $scripturl, $modSettings, $boardurl, $smcFunc, $context;
$check_game = !empty($_REQUEST['game']) ? (int) $_REQUEST['game'] : 0;

if ($check_game == false)
{
   $arcade = '<table><tr>';
   $count1 = 0;
   $icons_per_row = 4;
$id_game = false;
$user_info = false;
if (($context['user']['is_guest']) == false)
{
  $request = $smcFunc['db_query']('', '
      SELECT game.id_game, game.game_name, game.game_directory, game.thumbnail
      FROM {db_prefix}arcade_games AS game
     ORDER BY RAND()
   
      LIMIT 28',
array(
'game' => $id_game,
'string_empty' => '',
'member' => $user_info,
)
   );

   while ($row = $smcFunc['db_fetch_assoc']($request))
   {

      if ($count1 > ($icons_per_row - 1)){$count1 = 0; $arcade .= '</tr><tr>';}
      $count1++;
      $arcade .= '<td align="center"><a href="' . $scripturl . '?action=arcade;sa=play;game=' . $row['id_game'] . '"><img style="width:42px; height:42px;" src="' . $boardurl . '/Games/';
      if(isset($row['game_directory']) && $row['game_directory'] != '') {$arcade .= $row['game_directory'] . '/';}
      $arcade .= $row['thumbnail'] . '" alt="'.$row['game_name'].'" title="'.$row['game_name'].'" /></a></td>';
   
   }
$smcFunc['db_free_result']($request);
   
   $arcade .= '</tr></table>';
}
else
{
  $request = $smcFunc['db_query']('', '
      SELECT game.id_game, game.game_name, game.game_directory, game.thumbnail
      FROM {db_prefix}arcade_games AS game
     ORDER BY RAND()
   
      LIMIT 60',
array(
'game' => $id_game,
'string_empty' => '',
'member' => $user_info,
)
   );

   while ($row = $smcFunc['db_fetch_assoc']($request))
   {

      if ($count1 > ($icons_per_row - 1)){$count1 = 0; $arcade .= '</tr><tr>';}
      $count1++;
      $arcade .= '<td align="center"><a href="' . $scripturl . '?action=arcade;sa=play;game=' . $row['id_game'] . '"><img style="width:42px; height:42px;" src="' . $boardurl . '/Games/';
      if(isset($row['game_directory']) && $row['game_directory'] != '') {$arcade .= $row['game_directory'] . '/';}
      $arcade .= $row['thumbnail'] . '" alt="'.$row['game_name'].'" title="'.$row['game_name'].'" /></a></td>';
   
   }

   
   $arcade .= '</tr></table>';
}
   echo $arcade;
$smcFunc['db_free_result']($request);
}
Title: Re: SMF Arcade - Random games block
Post by: 420connect on April 27, 2015, 02:56:03 PM
another one I'm still looking to solve!
Title: Re: SMF Arcade - Random games block
Post by: ♦ Ninja ZX-10RR ♦ on April 27, 2015, 04:08:02 PM
Hmm, from what I remember SMF Arcade works with RC3, it's a very old mod and can have issues :/
Title: Re: SMF Arcade - Random games block
Post by: Chen Zhen on April 27, 2015, 05:50:43 PM
420connect,

  If you use SMF Arcade 2.5 RC3 (http://web-develop.ca/index.php?action=downloads;sa=view;down=5) (available at my website) or another version that allows the installation of the PDL plug-in (RC3 already includes this! - do not add if you use the RC3 version), then you can use the PHP block from this page: http://web-develop.ca/index.php?topic=19.msg19#msg19

Regards.
SimplePortal 2.3.8 © 2008-2024, SimplePortal