Pages: [1]
Author Topic: Show thumbs on Hot Games, Most raited, recently added  (Read 1479 times)
Customers
Newbie
*

Karma: 0
Posts: 1


Email
on: Apr 16, 11, 03:20 AM

Hello,

Im looking for a way to show the games thumbnails on the template where it displays the most recently added, most rated and the most popular games.

How can i get this done?

Thanks
Adam
Logged
Administrator
Sr. Member
*

Karma: 7
Posts: 486


Email
Reply #1 on: Apr 19, 11, 09:42 PM

I hope you are familiar with php. Take a look at the block_gamelist.php (the module which outputs the main game list), and find the variable $sThumb. In short, you should define in your "most popular games" block the same variable and the macro IMG (you'll use it in the block's html template). The code would be the following:
Code:
$sThumb = "content/thumbs/".$resGames[$nCurGame]["thumbnail"];
$sThumb = $cSite["sSiteRoot"].$sThumb;
$tpl->define( "IMG", $sThumb );
place it above the line "$tpl->parse..."

also replace in your block's code the string "SELECT id, title, latin_title, plays_total, active" by "SELECT *"

Please note, I didn't test this code, so it can be buggy, so some tweaking can be required
Logged
Newbie
*

Karma: 0
Posts: 2


Reply #2 on: Dec 15, 11, 09:26 AM

Here's what I did:


-------------------------------------------in block_mostplayed.html---------------------------------

basicly modified it so that it has the proper tags to display the images. Most of the code is taken from
block_catgame.html but I kept the <ul> tag in the hope that it's still gonna work when I will display the game with thumbs images. It didn't, it just shows me one game(the last game from the list).

Code:
<h2>Hot Games</h2>
<div class="GamesRow">

<div class="leftgame">
<ul>
              <div class="Thumb"><a href="!GAMEURL!">
<img class="Thumb" src="!IMG!" alt="Play !GAMETITLE!" />
<span class="mask"></span>
</a>
<div class="!PLAYS! plays"></div>
</div>
<p class="Title"><a href="!GAMEURL!">!GAMETITLE!</a></p>
<p class="Desc">!DESCRIPTION!</p>
</ul>
</div>
<!-- END DYNAMIC BLOCK: dynGamesRow -->
</div>
<br class="Clear"/>
<div class="BoxFooter"></div>


-------------------------------- in block_mostplayed.php---------------------------------------------

I added the neede functionality to the query search and  assign_array such as IMG, Description....


Code:
<?php
/*******************************************************************
/ ProArcadeScript version: 1.3.2
/ File description:
/ The "Most Played" shows the game that were played more times 
/ than the others
/
/ © 2007, ProArcadeScript. All rights reserved. 
/*******************************************************************/

// find out which script call this block
$sScript substr(strrchr($_SERVER['SCRIPT_NAME'], "/"), 1);


$tpl->define"tplBMostPlayed""block_mostplayed.html" );
$tpl->define_dynamic"dynGame""tplBMostPlayed" );

if( 
$sScript == "cat.php" )
$query "SELECT id, category_id, title, latin_title,thumbnail, plays_total,description, active FROM " $cMain["dbPrefix"] . "games 

WHERE active=1 AND category_id="
$nCategory ." ORDER BY plays_total DESC LIMIT " $cB["MOSTPLAYED"]["max"];
else
$query "SELECT id, title, latin_title,thumbnail, plays_total,description,active FROM " $cMain["dbPrefix"] . "games WHERE active=1 

ORDER BY plays_total DESC LIMIT " 
$cB["MOSTPLAYED"]["max"];
$res $db->super_query$querytrue );


$tpl->define_dynamic"dynGamesRow""tplBGame" );

if( 
$res[0]["plays_total"] > )
{
foreach($res as $i => $values)
if( $values["plays_total"] > )
{
                       
$sThumb "content/thumbs/".$values["thumbnail"];
if( file_exists($sThumb) )
$sThumb $cSite["sSiteRoot"].$sThumb;
else
$sThumb $cSite["sSiteRoot"]."templates/".$cSite["sTemplate"]."/images/no_image.gif";

$tpl->assign(array(
"GAMEURL" => GameURL$values["id"], $values["latin_title"] ),
                                
"IMG"=> $sThumb,
"GAMETITLE" => $values["title"],
"PLAYS" => $values["plays_total"],
                                
"DESCRIPTION" => $values["description"]
                                
));

$tpl->parse"MOSTPLAYED"".dynGame" );
                        
$tpl->parse"DYNGAMES"".dynGamesRow" );
}
$tpl->parse"MOSTPLAYED""tplBMostPlayed" );
}
else
$tpl->assign"MOSTPLAYED""" );
?>

Problem: it shows only one game. What I want it to be able to show them as a block of games like in categories or one beneath the other as a list.

Thanks
Logged
Pages: [1]
 
Jump to: