* User

Welcome, Guest. Please login or register.
Did you miss your activation email?

19 Mar 10, 20:51:32

Login with username, password and session length

Select language:

* Recent Topics



Donate

Donate for PortaMx !
Your donation is safe and helps support the issues and causes you care most about.

* Stats

  • *Total Members: 1991
  • *Latest: Newbster

  • *Total Posts: 9255
  • *Total Topics: 1343
  • *Online Today: 34
  • *Most Online: 157
(27 Aug 09, 03:54:53)
  • *Users: 3
  • *Guests: 13
  • *Spiders: 0
  • *Total: 16

* Themes

*

Author Topic: SMF Arcade 2.5.x Blocks  (Read 467 times)

0 Members and 1 Guest are viewing this topic.

Offline nend

  • Newbie
  • *
  • Posts: 13
SMF Arcade 2.5.x Blocks
« on: 20 Jan 10, 20:35:05 »
These are my SMF Arcade blocks, hope it will prove useful.

Demo - http://www.2-si.net/index.php?action=arcade

Latest Games
Code: [Select]
global $db_prefix, $scripturl, $modSettings, $smcFunc, $txt;

$limit=5;

$results = $smcFunc['db_query']('', '
SELECT id_game, internal_name, game_name, game_directory, thumbnail, enabled
FROM {db_prefix}arcade_games
WHERE enabled=1
ORDER BY id_game DESC
LIMIT 0,{int:num}',
array(
'num' => $limit,
)
);

while ($newest_game = mysql_fetch_assoc($results)){
$newgam .= '
<td width="20%"><center><a href="'.$scripturl.'?action=arcade;sa=play;game='.$newest_game['id_game'].'"><img src="'.$modSettings['gamesUrl'].'/'.$newest_game['game_directory'].'/'.$newest_game['thumbnail'].'" width="100" height="100" alt="Play '.$newest_game['game_name'].'" title="Play '.$newest_game['game_name'].'" /><br />'.$newest_game['game_name'].'</a></center></td>';
}
empty($newgam) ? $newgam = $txt['arcade_no_games'] : '';
$smcFunc['db_free_result']($results);
echo '<table width="100%"><tr>'.$newgam.'</tr></table>';

Random Games
Code: [Select]
global $db_prefix, $scripturl, $modSettings, $smcFunc, $txt;

$limit=5;
$results = $smcFunc['db_query']('', '
SELECT id_game, game_directory, thumbnail, game_name, enabled
FROM {db_prefix}arcade_games
WHERE enabled = 1
ORDER BY RAND()
LIMIT {int:num}',
array(
'num' => $limit,
)
);

while ($rg = mysql_fetch_assoc($results)){
$random .= '
<td width="20%"><center><a href="'.$scripturl.'?action=arcade;sa=play;game='.$rg['id_game'].'"><img class="imgBorder" src="'.$modSettings['gamesUrl'].'/'.$rg['game_directory'].'/'.$rg['thumbnail'].'" width="100" height="100" alt="'.$rg['game_name'].'"  title="Play '.$rg['game_name'].'" /></a><br />
<a href="'.$scripturl.'?action=arcade;sa=play;game='.$rg['id_game'].'">'.$rg['game_name'].'</a></center></td>';
}

empty($random) ? $random = '<div class="smalltext centertext">'. $txt['arcade_no_games'] .'</div>' : '';
$smcFunc['db_free_result']($results);
echo '<table width="100%"><tr>'.$random.'</tr></table>';

Popular Games
Code: [Select]
// Returns most played games
global $db_prefix, $scripturl, $context, $modSettings, $smcFunc, $txt;

$count = 5;

$results = $smcFunc['db_query']('', '
SELECT id_game, game_name, game_directory, thumbnail, enabled, num_plays
FROM {db_prefix}arcade_games
WHERE num_plays != 0 AND enabled = 1
ORDER BY num_plays DESC
LIMIT {int:num}',
array(
'num' => $count,
)
);

while ($score = mysql_fetch_assoc($results)){
$pop .= '<td width="20%"><center><img src="'.$modSettings['gamesUrl'].'/'.$score['game_directory'].'/'.$score['thumbnail'].'" width="100" height="100" alt="Play '.$score['game_name'].'" title="Play '.$score['game_name'].'" /></a><br /><a href="'.$scripturl.'?action=arcade;sa=play;game='.$score['id_game'].'">'.$score['game_name'].'</a></center></td>';
}

$smcFunc['db_free_result']($results);
empty($pop) ? $pop = $txt['arcade_popular_none'] : '';
echo '<table width="100%"><tr>'.$pop.'</tr></table>';

Latest Champs
Code: [Select]
global $smcFunc, $db_prefix, $scripturl, $txt, $modSettings, $context;
$count = 5;

$request = $smcFunc['db_query']('', '
SELECT game.id_game, game.game_name, game.game_directory, game.thumbnail, score.score, score.position, score.end_time,
IFNULL(mem.id_member, 0) AS id_member, IFNULL(mem.real_name, score.player_name) AS real_name
FROM ({db_prefix}arcade_scores AS score, {db_prefix}arcade_games AS game)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = score.id_member)
WHERE score.position = 1 AND game.id_game = score.id_game
ORDER BY end_time DESC
LIMIT {int:count}',
array(
'count' => $count,
'empty' => ''
)
);

while ($row = $smcFunc['db_fetch_assoc']($request)){
$code .= '<td width="20%"><center><a href="'.$scripturl.'?action=arcade;sa=play;game='.$row['id_game'].'"><img src="'.$modSettings['gamesUrl'] .'/'.$row['game_directory'].'/'.$row['thumbnail'].'" border="0" alt="'.$row['game_name'].'" title="'.$row['game_name'].'" width="100" height="100" /></a><br /><a href="'.$scripturl.'?action=profile;u='.$row['id_member'].'">'.$row['real_name'].'</a><br /><a href="'.$scripturl.'?action=arcade;sa=play;game='.$row['id_game'].'">'.$row['game_name'].'</a></center></td>';

}
$smcFunc['db_free_result']($results);
echo '<table width="100%"><tr>'.$code.'</tr></table>';

Categories
Code: [Select]
global $smcFunc, $db_prefix, $context, $scripturl, $txt;

$result = $smcFunc['db_query']('', '
SELECT cat_name, id_cat
FROM {db_prefix}arcade_categories
ORDER BY cat_order');

while ($cat = $smcFunc['db_fetch_assoc']($result)) {
echo '
<a href="'.$scripturl.'?action=arcade;category='.$cat['id_cat'].'"><b>'.$cat['cat_name'].'</b></a><br />';
}
$smcFunc['db_free_result']($result);

Offline feline

  • CO PortaMx corp.
  • Administrator
  • *
  • Posts: 2842
  • Gender: Female
Re: SMF Arcade 2.5.x Blocks
« Reply #1 on: 20 Jan 10, 23:08:29 »
You are welcome .. and thanks for sharig  :)

Fel
Many are stubborn in relation to the path, a few in relation to the target.

Offline ozzie1958

  • Newbie
  • *
  • Posts: 4
  • Gender: Male
Re: SMF Arcade 2.5.x Blocks
« Reply #2 on: 06 Feb 10, 21:14:31 »
The site looks great...........i am new to all this and only installed this portal today and would love to do the same....how and where would i add these code arcade code snippets in portal admin or am i on the wrong lines and have to do sommat else.I dont know alot about coding but can find my way around adding bits of code and editing...


proberbly posted this in wrong place and i make my appologise now

Offline feline

  • CO PortaMx corp.
  • Administrator
  • *
  • Posts: 2842
  • Gender: Female
Re: SMF Arcade 2.5.x Blocks
« Reply #3 on: 07 Feb 10, 17:45:07 »
You can put the above code in PHP blocks ...

Fel
Many are stubborn in relation to the path, a few in relation to the target.

Offline ozzie1958

  • Newbie
  • *
  • Posts: 4
  • Gender: Male
Re: SMF Arcade 2.5.x Blocks
« Reply #4 on: 07 Feb 10, 18:06:04 »
Thanks i have kinda worked that out now as i say i brand new to all this and it all trial and error and im experimenting as i go,my next thing is to work out what all other funtions do ..namely single page thing etc and how to intergrate it all.......i've looked around the site (albeit blindly) for guides but to no avail,could u point me towards any helpful tutorials ? please..


Many Thanks for your reply.. O0

btw i set up a trial site on xampp so i dont break my own whilst experimenting  ::)

Offline feline

  • CO PortaMx corp.
  • Administrator
  • *
  • Posts: 2842
  • Gender: Female
Re: SMF Arcade 2.5.x Blocks
« Reply #5 on: 07 Feb 10, 18:51:14 »
Thanks i have kinda worked that out now as i say i brand new to all this and it all trial and error and im experimenting as i go,my next thing is to work out what all other funtions do ..namely single page thing etc and how to intergrate it all.......i've looked around the site (albeit blindly) for guides but to no avail,could u point me towards any helpful tutorials ? please..
We don't have any tutorial .. most of the block types don't need special know how.

Quote
btw i set up a trial site on xampp so i dont break my own whilst experimenting  ::)
Yea, that is a good option to test out all the porta functions  ;)

Fel
Many are stubborn in relation to the path, a few in relation to the target.