Arcade Toolbar Block

Started by Chen Zhen, July 06, 2013, 03:19:22 PM

Previous topic - Next topic

Chen Zhen

SMF ARCADE v2.5 - PHP Portal Block - Toolbar


Create a php block titled: Arcade Toolbar

Put the following code in it:

/*  SMF Arcade v2.5 Toolbar  */
/* c/o Underdog @askusaquestion.net */
/* For use with a php portal block or insert into your arcade template  */


global $boardurl, $scripturl, $context, $modSettings;
$id_of_game = !empty($_REQUEST['game']) ? (int) $_REQUEST['game'] : 0;
$image_width = 30;
$image_height = 30;

$tab='<td class="windowbg2" nowrap="nowrap" style="cursor: pointer; font-size: 11px; padding: 6px 10px 6px 10px;  border: solid 1px #ADADAD;border-top: 0px; border-bottom:0px; border-left:0px;text-align:center;vertical-align:top;" onmouseover="this.style.backgroundPosition=\'0 -5px\'" onmouseout="this.style.backgroundPosition=\'0 0px\'">';       
$viewit = '
<table  summary="arcade_toolbar" cellpadding="0" cellspacing="0" border="0" style="overflow:hidden; position: absolute;">
<tr valign="top" align="left">';
$viewit .=$tab.'<a href="'.$boardurl.'/index.php?action=arcade;sort=name;desc=DESC"><img src="'.$boardurl.'/Themes/default/images/arc_icons/arcade_home.jpg" width='.$image_width.' height='.$image_height.' title="Arcade Home" alt="" /></a></td>';
$viewit .=$tab.'<a href="'.$boardurl.'/index.php?action=arcade;sa=stats"><img src="'.$boardurl.'/Themes/default/images/arc_icons/arcade_stats.jpg" width='.$image_width.' height='.$image_height.'  title="Statistics" alt="" /></a></td>';
if (AllowedTo('arcade_admin'))
{
$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=admin;area=arcade;sa=main;"><img src="'.$boardurl.'/Themes/default/images/arc_icons/arcade_admin.jpg" width='.$image_width.' height='.$image_height.'  title="Admin Arcade" alt="" /></a></td>';

$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=admin;area=managegames;sa=main;"><img src="'.$boardurl.'/Themes/default/images/arc_icons/arcade_edit.jpg" width='.$image_width.' height='.$image_height.'  title="Edit Games" alt="" /></a></td>';

$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=admin;area=arcadecategory;sa=list;"><img src="'.$boardurl.'/Themes/default/images/arc_icons/category.jpg"width='.$image_width.' height='.$image_height.'  title="Categories" alt="" /></a></td>';

$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=admin;area=arcademaintenance;sa=main;"><img src="'.$boardurl.'/Themes/default/images/arc_icons/maintain.jpg" width='.$image_width.' height='.$image_height.'  title="Maintenance" alt="" /></a></td>';
}
if (($context['user']['is_guest']) == false)
{
$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=arcade;sa=arena;"><img src="'.$boardurl.'/Themes/default/images/arc_icons/arena.jpg" width='.$image_width.' height='.$image_height.'  title="Arena" alt="" /></a></td>';
if(empty($modSettings['arcadeEnableDownload'])) {$modSettings['arcadeEnableDownload'] = false;}
if ((AllowedTo('arcade_download')) && ($modSettings['arcadeEnableDownload'] == true))
{$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=arcade;sa=download;game='.$id_of_game.'"><img src="'.$boardurl.'/Themes/default/images/arc_icons/download.jpg" width='.$image_width.' height='.$image_height.'  title="Download" alt="" /></a></td>';}
}
$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=arcade;sort=plays;desc=DESC"><img src="'.$boardurl.'/Themes/default/images/arc_icons/most_played.gif" width='.$image_width.' height='.$image_height.'  title="Most Popular" alt="" /></a></td>';

if (($context['user']['is_guest']) == false)
{
$viewit .= $tab.'<a href="'.$boardurl.'/index.php?action=arcade;favorites"><img src="'.$boardurl.'/Themes/default/images/arc_icons/favorites.gif" width='.$image_width.' height='.$image_height.'  title="Favorites" alt="" /></a></td>';
}

$viewit .= '<td class="windowbg2" nowrap="nowrap" style="cursor: pointer; font-size: 11px; padding: 6px 10px 6px 10px;  border-top: 0px; border-bottom:0px; border-left:0px;text-align:center;vertical-align:top;"><a href="'.$boardurl.'/index.php?action=arcade;sort=age;desc=DESC"><img src="'.$boardurl.'/Themes/default/images/arc_icons/newgames.gif" width='.$image_width.' height='.$image_height.'  title="New Games" alt="" /></a></td>';

$viewit .= '</tr></table><br /><br /><br />';

echo $viewit;


-----------------------------------------------------------------------------------------------------------------


For 'Display Options' choose advanced and set custom display to:
~action|arcade

Download the attachment - unzip it on your pc/mac and upload all the images into:
/ Themes / default / images / arc_icons
(Create the folder if it doesn't exist)

aquarius

I'd love to see a screenshot of what this does... I'll apply it and update this thread

Chen Zhen


You always have the option of installing a localhost platform on your PC/Mac to test things.
This way you can install SMF, the Arcade & a portal.
Install a few games at that point, perhaps briefly play a few of them to create scores in the database.
After all that you can copy & paste all these blocks to see if they work & how they look.

Most of these posted blocks were for an older version of the arcade but they should work.
If any of them give you trouble just post in the appropriate thread & I can take a look.

Chen Zhen

If you are not familiar with localhost servers, just search for Xampp or Wampserver.
Both can be used on a PC but only Xampp is available for Mac OSX or Unix.

vince

wheres the attachment for this please

vince

Quote from: vince on August 12, 2020, 07:09:11 PMwheres the attachment for this please
maybe have this centered aswell it would look better...

Chen Zhen

This block is obsolete & will no longer work with the upcoming release.