Latest Games Block

Started by Chen Zhen, July 06, 2013, 02:59:32 PM

Previous topic - Next topic

Chen Zhen

SMF 2.0 Rcx and SMF Arcade

Latest games block (icons only):

Create a new php block...

Enter this for custom display options:
(For viewing on portal - leave this line blank)


Change '$icons_per_row' to equal the amount preferred
Change 'LIMIT' to equal the amount preferred

Main code:

// Latest games block by Underdog
// For SMF2.0 Rcx and SMF Arcade
// Arcade page already has latest game command
// - it just needs a button put on the arcade page
// Suggested placement is on portal

global $db_prefix, $scripturl, $modSettings, $boardurl, $smcFunc;
   $arcade = '<table><tr>';
   $count1 = 0;
   $icons_per_row = 4;

   $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 game.id_game DESC   
      LIMIT 44', array()
   while ($row = $smcFunc['db_fetch_assoc']($request))
      if ($count1 > ($icons_per_row - 1)){$count1 = 0; $arcade .= '</tr><tr>';}
      $count1 =$count1 + 1;
      $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;


Thank you @Chen Zhen

In case anyone needs to know, this can also be applied to Tiny Portal blocks or inserted into a template.


Where do i change the code so it will be responsible like it is in random games?