*

Recent

Author Topic: Show Top Game On Left Side!!!  (Read 13060 times)

Sterling

  • Jr. Member
  • **
  • Posts: 81
  • Force: +1/-0
    • Hitchhike games
Show Top Game On Left Side!!!
« on: April 26, 2009, 05:52:38 PM »
To see an example of this go to my website at http://www.hitchhikegames.com.

Okay, to display your websites top game find "templates/default/header.php" and make a copy of it just in case. Then with the original file do the following...

Replace its code with this...
Code: [Select]
<html>
<head>
<meta name="keywords" content="flash games,free flash games,games,arcade games¸sonic,nintendo,online" />
<meta name="description" content="Take a break play some free games,facebook games" />
<link href="<?=$domain?>/templates/default/styles.css" rel="stylesheet" type="text/css">
<?php
include ("js/rating_update.php");
?>

</head>
<body>
<table width="900" border="0" align="center" class="maintable" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3">
<img src="<?=$domain?>/templates/default/images/banner.png" width="900"></img>

<?php

      
if (!$headerspace == "") { echo '<br><div align="center">'.$headerspace.'</div><br>'; };


echo ' <div class=\'menutop\'>';
if($seo_on == 1){
echo ' <ul>
<li><a href=\''
.$domain.'\' title=\'Home\'>Home</a></li>
<li><a href=\''
.$domain.'/mostplayed/\' title=\'Most Played\'>Most Played</a></li>
<li><a href=\''
.$domain.'/newest/\' title=\'Newest\'>Newest</a></li><li><a href="'.$domain.'/memberslist/" title="Member List">Member List</a></li>
<li><a href=\''
.$domain.'/search/\' title=\'Search\'>Search</a></li>
<li class=\'floatr\'><!-- AddThis Button BEGIN -->
<a href="http://www.addthis.com/bookmark.php" onclick="addthis_url   = location.href; addthis_title = document.title; return addthis_click(this);" target="_blank"><img src="http://s7.addthis.com/static/btn/lg-share-en.gif" width="125" height="16" border="0" alt="Bookmark and Share" /></a><script type="text/javascript">var addthis_pub = "sssox";</script><script type="text/javascript" src="http://s7.addthis.com/js/widget.php?v=10"></script>  
<!-- AddThis Button END --></li>'
;
if(!isset($suserid)){
echo ' <li class=\'floatr\'><a href=\''.$domain.'/login/\'>Login</a></li>
<li class=\'floatr\'><a href=\''
.$domain.'/signup/\'>Signup</a></li>';
}else{
echo ' <li class=\'floatr\'>Hey '.$usrdata['username'].'</li>
<li class=\'floatr\'><a href=\''
.$domain.'/myaccount/\'>My Account</a></li>
<li class=\'floatr\'><a href=\''
.$domain.'/logout/\'>Logout</a></li>';
}
echo ' </ul>';
}else{
echo ' <ul>
<li><a href=\''
.$domain.'\' title=\'Home\'>Home</a></li>
<li><a href=\''
.$domain.'/index.php?action=mostplayed\' title=\'Most Played\'>Most Played</a></li>
<li><a href=\''
.$domain.'/index.php?action=newest\' title=\'Newest\'>Newest</a></li><li><a href="'.$domain.'/memberslist/" title="Member List">Member List</a></li>
<li><a href=\''
.$domain.'/index.php?action=search\' title=\'Search\'>Search</a></li>\'>
<li class=\'floatr\'><!-- AddThis Button BEGIN -->
<a href="http://www.addthis.com/bookmark.php" onclick="addthis_url   = location.href; addthis_title = document.title; return addthis_click(this);" target="_blank"><img src="http://s7.addthis.com/static/btn/lg-share-en.gif" width="125" height="16" border="0" alt="Bookmark and Share" /></a><script type="text/javascript">var addthis_pub = "sssox";</script><script type="text/javascript" src="http://s7.addthis.com/js/widget.php?v=10"></script>  
<!-- AddThis Button END --></li>'
;
if(!isset($suserid)){
echo ' <li class=\'floatr\'><a href=\''.$domain.'/index.php?action=login\'>Login</a></li>
<li class=\'floatr\'><a href=\''
.$domain.'/index.php?action=signup\'>Signup</a></li>';
}else{
echo ' <li class=\'floatr\'>Hey '.$usrdata['username'].'</li>
<li class=\'floatr\'><a href=\''
.$domain.'/index.php?action=myaccount\'>My Account</a></li>
<li class=\'floatr\'><a href=\''
.$domain.'/index.php?action=logout\'>Logout</a></li>';
}
echo '
</ul>'
;
}
echo ' </div>';

?>

<br />
<br />
<br />
</td>
</tr>
<tr>
<td valign="top" width="170">
<table width="100%">
<tr>
<td class="header2">Banner Exchanges</td>
</tr>

<tr>
<td class="content2"><?php echo $bannersleft?></td>
</tr>

<tr>
<td class="header2">Game Categories</td>
</tr>

<tr>
<td class="content2">
<?php
echo '<ul class=\'catmenu\'>';

$rci $db->query('SELECT * FROM dd_categories');

while($row $db->Fetch_row($rci)){
$numrws =$db->query(sprintf('SELECT ID FROM dd_games WHERE category=\'%u\''$row['ID']));
$cnumrws $db->num_rows($numrws);
$categoryname ereg_replace('[^A-Za-z0-9]'''$row['name']);
       if($seo_on == 1){
       $categoryurl ''.$domain.'/browse/'.$row['ID'].'-'.$categoryname.'.html';
       }else{
       $categoryurl ''.$domain.'/index.php?action=browse&amp;ID='.$row['ID'].'';
       }
echo '<li><a href=\''.$categoryurl.'\'>'.$row['name'].' ('.$cnumrws.')</a></li>';
}


echo '</ul>';
?>

</td>
</tr>
</table>
    <table width="100%">
              <tr>
                <td class="header2">Top Game</td>
              </tr>
              <tr>
                <td class="content2"><?php
;
if(empty(
$show)){
$show 1;
}
$limits = ($show 1) * $max
$r $db->query(sprintf('SELECT * FROM dd_games ORDER BY views DESC LIMIT 0,1'));
$totalres mysql_result($db->query('SELECT COUNT(ID) AS total FROM dd_games'),0);
$totalpages ceil($totalres $max); 
echo 
'<table width=\'100%\' border=\'0\' align=\'center\'>
<tr>
</tr>'
;
$count 0;
while(
$in $db->fetch_row($r)){
$gamename ereg_replace('[^A-Za-z0-9]'''$in['name']);
if($seo_on == 1){
$playlink ''.$domain.'/play/'.$in['ID'].'-'.$gamename.'.html';
}else{
$playlink ''.$domain.'/index.php?action=play&amp;ID='.$in['ID'].'';
}
if(
$count%2==0){

       echo 
'<tr>
       <td width=\'50%\' valign=\'top\'>
      
       <table width=\'100%\' border=\'0\'>
       <tr>
       <td valign=\'top\' colspan=\'2\' class=\'header5\'><b>'
.$in['name'].'</b></td>
       </tr>
       <tr>
       <td width=\'55\' height=\'55\' valign=\'top\' class=\'content5\'>
       <a href=\''
.$playlink.'\'>
       '
;
       if($in['type'] == 1){
       echo ' <img src=\''.$domain.'/'.$thumbsfolder.'/'.$in['thumb'].'\' width=\'55\' width=\'55\' border=\'0\'>';
       }else{
       echo ' <img src=\''.$in['thumburl'].'\' width=\'55\' width=\'55\' border=\'0\'>';
       }
      
       echo ' </a>
       </td> <td>
       <a href=\''
.$playlink.'\' class=\'playlink\'><b>Play</b></a></td>
       </tr>
       </table>
      
       </td>
'
;
}else{
 echo 
'';
}
$count++;
}

echo 
"</table>";
?>
&nbsp;</td>
              </tr>
            </table>
      <?php
if($usrdata['user_level'] == 2){
?>

  <table width="100%">
<tr>
<td class="header2">Admin Panel</td>
</tr>
<tr>
<td class="content2">
<?php
echo '<ul class=\'catmenu\'>
<li><a href=\''
.$domain.'/index.php?action=admin&case=addgame\'>Add Game</a></li>
<li><a href=\''
.$domain.'/index.php?action=admin&case=managegames\'>Manage Games</a></li>
<li><a href=\''
.$domain.'/index.php?action=admin&case=addcategory\'>Add Category</a></li>
<li><a href=\''
.$domain.'/index.php?action=admin&case=managecategories\'>Manage Categories</a></li>
<li><a href=\''
.$domain.'/index.php?action=admin&case=addlink\'>Add Link</a></li>
<li><a href=\''
.$domain.'/index.php?action=admin&case=managelinks\'>Manage Links</a></li>
<li><a href=\''
.$domain.'/index.php?action=admin&case=approvecomments\'>Approve Comments</a></li>
<li><a href=\''
.$domain.'/index.php?action=admin&case=settings\'>Site Settings</a></li>
</ul>'
;
?>

</td>
</tr>
</table>
<?
}
?>
<table width="100%">
<tr>
<td class="header2">Top Users</td>
</tr>

<tr>
<td class="content2">

<?php
echo '<ul class=\'catmenu\'>';

$tur $db->query('SELECT username, userid, plays FROM dd_users ORDER BY plays DESC LIMIT 0,15');
while($r $db->fetch_row($tur)){
echo '
<li>'
.$r['username'].' - ('.$r['plays'].')</li>';
}
echo '

</ul>'
;
?>

<p>

</td>

</tr>

<tr>
<td class="header2">Ads</td>
</tr>


<tr>
<td class="content2">


<?php echo $ads1?>
<p>
</td>

</tr>
</table>
</td>
<td valign="top" width="660">

If you know PHP well you'll see the code is a little sloppy, But it does work beautifully!!! ;D


Let me know if you like it or if you have any questions!!!!

« Last Edit: April 29, 2009, 10:48:42 AM by admin »

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: Show Top Game On Left Side!!!
« Reply #1 on: April 26, 2009, 07:21:57 PM »
Kewl!

legitnick

  • Newbie
  • *
  • Posts: 7
  • Force: +0/-0
Re: Show Top Game On Left Side!!!
« Reply #2 on: April 29, 2009, 10:30:25 AM »
Thanks so much sterling
ps. Im still the php master  :o

Robbie

  • Sr. Member
  • ****
  • Posts: 343
  • Force: +16/-0
Re: Show Top Game On Left Side!!!
« Reply #3 on: April 29, 2009, 10:43:19 AM »
Nice to see this  ;D please feel free to send us your ideas and reply to questions guys . I have to say Kurt has been tremendous on working so hard on this script .


« Last Edit: April 29, 2009, 10:49:16 AM by admin »

Trasion

  • Guest
Re: Show Top Game On Left Side!!!
« Reply #4 on: July 20, 2009, 02:40:47 PM »


What's wrong with it?

Here's everything that I added and/or edited from what you told us to add.

Code: [Select]
    <table width="100%">
              <tr>
                <td class="header2">Top Game</td>
              </tr>
              <tr>
                <td class="content2"><?php
;
if(empty(
$show)){
$show 1;
}
$limits = ($show 1) * $max
$r $db->query(sprintf('SELECT * FROM dd_games ORDER BY views DESC LIMIT 0,1'));
$totalres mysql_result($db->query('SELECT COUNT(ID) AS total FROM dd_games'),0);
$totalpages ceil($totalres $max); 
echo 
'<table width=\'100%\' border=\'0\' align=\'center\'>
<tr>
</tr>'
;
$count 0;
while(
$in $db->fetch_row($r)){
$gamename ereg_replace('[^A-Za-z0-9]'''$in['name']);
if($seo_on == 1){
$playlink ''.$domain.'/play/'.$in['ID'].'-'.$gamename.'.html';
}else{
$playlink ''.$domain.'/index.php?action=play&amp;ID='.$in['ID'].'';
}
if(
$count%2==0){

       echo 
'<tr>
       <td width=\'50%\' valign=\'top\'>
      
       <table width=\'100%\' border=\'0\'>
       <tr>
       <td valign=\'top\' colspan=\'2\' class=\'header5\'><b>'
.$in['name'].'</b></td>
       </tr>
       <tr>
       <td width=\'55\' height=\'55\' valign=\'top\' class=\'content5\'>
       <a href=\''
.$playlink.'\'>
       '
;
       if($in['type'] == 1){
       echo ' <img src=\''.$domain.'/'.$thumbsfolder.'/'.$in['thumb'].'\' width=\'55\' width=\'55\' border=\'0\'>';
       }else{
       echo ' <img src=\''.$in['thumburl'].'\' width=\'55\' width=\'55\' border=\'0\'>';
       }
      
       echo ' </a>
       </td> <td>
       <a href=\''
.$playlink.'\' class=\'playlink\'><b>Play</b></a></td>
       </tr>
       </table>
</td>
'
;
}else{
 echo 
'';
}
$count++;
}
echo 
"</table>";
?>
&nbsp;</td>
              </tr>
            </table>

Could you tell me why it's showing me that error?

Adam LaCombe

  • Sr. Member
  • ****
  • Posts: 433
  • Force: +17/-0
    • My Blog
Re: Show Top Game On Left Side!!!
« Reply #5 on: July 20, 2009, 03:00:31 PM »
Well the error is coming from $totalpages = ceil($totalres / $max);
But im not getting why there should be anything there about paging...  ???

Code: [Select]
    <table width="100%">
              <tr>
                <td class="header2">Top Game</td>
              </tr>
              <tr>
                <td class="content2"><?php

$r 
$db->query(sprintf('SELECT * FROM dd_games ORDER BY views DESC LIMIT 0,1'));
echo 
'<table width=\'100%\' border=\'0\' align=\'center\'>
<tr>
</tr>'
;
$count 0;
while(
$in $db->fetch_row($r)){
$gamename ereg_replace('[^A-Za-z0-9]'''$in['name']);
if($seo_on == 1){
$playlink ''.$domain.'/play/'.$in['ID'].'-'.$gamename.'.html';
}else{
$playlink ''.$domain.'/index.php?action=play&amp;ID='.$in['ID'].'';
}
if(
$count%2==0){

       echo 
'<tr>
       <td width=\'50%\' valign=\'top\'>
      
       <table width=\'100%\' border=\'0\'>
       <tr>
       <td valign=\'top\' colspan=\'2\' class=\'header5\'><b>'
.$in['name'].'</b></td>
       </tr>
       <tr>
       <td width=\'55\' height=\'55\' valign=\'top\' class=\'content5\'>
       <a href=\''
.$playlink.'\'>
       '
;
       if($in['type'] == 1){
       echo ' <img src=\''.$domain.'/'.$thumbsfolder.'/'.$in['thumb'].'\' width=\'55\' width=\'55\' border=\'0\'>';
       }else{
       echo ' <img src=\''.$in['thumburl'].'\' width=\'55\' width=\'55\' border=\'0\'>';
       }
      
       echo ' </a>
       </td> <td>
       <a href=\''
.$playlink.'\' class=\'playlink\'><b>Play</b></a></td>
       </tr>
       </table>
</td>
'
;
}else{
 echo 
'';
}
$count++;
}
echo 
"</table>";
?>
&nbsp;</td>
              </tr>
            </table>

try that.

Trasion

  • Guest
Re: Show Top Game On Left Side!!!
« Reply #6 on: July 20, 2009, 03:41:33 PM »
It works! Thank you. :)

Adam LaCombe

  • Sr. Member
  • ****
  • Posts: 433
  • Force: +17/-0
    • My Blog
Re: Show Top Game On Left Side!!!
« Reply #7 on: July 20, 2009, 03:55:23 PM »
No prob  8)

Sterling

  • Jr. Member
  • **
  • Posts: 81
  • Force: +1/-0
    • Hitchhike games
Re: Show Top Game On Left Side!!!
« Reply #8 on: July 28, 2009, 02:21:12 PM »
I think there is problems with it now because it was made for a older version script...like v1.1..SORRY!!! :'(

Adam LaCombe

  • Sr. Member
  • ****
  • Posts: 433
  • Force: +17/-0
    • My Blog
Re: Show Top Game On Left Side!!!
« Reply #9 on: August 07, 2009, 10:43:24 PM »
I had some time so I decided to fix up this addon a little more.
here it is:
Code: [Select]
<table width="100%">
              <tr>
                <td class="header2">Top Game</td>
              </tr>
              <tr>
                <td class="content2"><?php

$r 
mysql_query("SELECT * FROM dd_games ORDER BY views DESC LIMIT 0,1");
echo 
'<table width="100%" border="0" align="center">
<tr>
</tr>'
;
while(
$in mysql_fetch_array($r)){
$gamename $in['name'];
$description=substr($in['description'], 017);

if($seo_on == 1){
$playlink ''.$domain.'/play/'.$in['ID'].'-'.$gamename.'.html';
}else{
$playlink ''.$domain.'/index.php?action=play&amp;ID='.$in['ID'].'';
}

       echo 
'<tr>
       <td width="50%" valign="top">
      
       <table width="100%" border="0">
       <tr>
       <td valign="top" colspan="2" class="header5"><b>'
.$in['name'].'</b></td>
       </tr>
       <tr>
       <td width="45" height="45" valign="top" class="content5">
       <a href="'
.$playlink.'">';
if($in['type'] == 1){
$image='<img src="'.$domain.'/'.$thumbsfolder.'/'.$in['thumb'].'" width="45" height="45" border="0">';
}else{
$image='<img src="'.$in['thumburl'].'" width="45" height="45" border="0">';
}
       echo ''.$image.'</a>
       </td> <td><small>'
.$description.'...</small> 
       <a href="'
.$playlink.'" class="playlink"><b>Play</b></a></td>
       </tr>
       </table>
</td>'
;
}
?>

            </table>
</table>


I removed the pagination stuff and added in a description area, the description is limited to 17 characters but you can change that,
$description=substr($in['description'], 0, 17);

and this is what it looks like:

Trasion

  • Guest
Re: Show Top Game On Left Side!!!
« Reply #10 on: September 04, 2009, 03:28:34 PM »
Code: [Select]
    <table cellpadding="0" cellspacing="0" width="100%">
              <tr>
                <td class="header2">Random Game</td>
              </tr>
              <tr>
                <td class="content2"><?php

$r 
$db->query(sprintf('SELECT * FROM dd_games ORDER BY RAND() DESC LIMIT 0,1'));
echo 
'<table width=\'100%\' border=\'0\' align=\'center\'>
<tr>
</tr>'
;
$count 0;
while(
$in $db->fetch_row($r)){
$gamename ereg_replace('[^A-Za-z0-9]'''$in['name']);
if($seo_on == 1){
$playlink ''.$domain.'/play/'.$in['ID'].'-'.$gamename.'.html';
}else{
$playlink ''.$domain.'/index.php?action=play&amp;ID='.$in['ID'].'';
}
if(
$count%2==0){

       echo 
'<tr>
       <td width=\'50%\' valign=\'top\'>
      
       <table width=\'100%\' border=\'0\'>
       <tr>
       <td valign=\'top\' colspan=\'2\' class=\'header\' style="background-color:#F2F2F2;border-bottom:0px;"><center><b>'
.$in['name'].'</b></center></td>
       </tr>
<tr>
<td>

</td>
</tr>
       <tr>
       <td width=\'55\' height=\'55\' valign=\'top\' class=\'content5\'>
       <a href=\''
.$playlink.'\'>
       '
;
       if($in['type'] == 1){
       echo ' <img src=\''.$domain.'/'.$thumbsfolder.'/'.$in['thumb'].'\' width=\'55\' height=\'55\' border=\'1px solid #000000\'>';
       }else{
       echo ' <img src=\''.$in['thumburl'].'\' width=\'55\' height=\'55\' border=\'0\'>';
       }
      
       echo ' </a>
       </td> <td>
       <a href=\''
.$playlink.'\' class=\'playlink\'><b>Click to Play</b><br />Plays: 405</a></td>
       </tr>
       </table>
</td>
'
;
}else{
 echo 
'';
}
$count++;
}
echo 
"</table>";
?>
&nbsp;</td>
              </tr>
            </table>

That's my version of this script. Now, see where it says "Plays: 405"? How can I actually change the "405" to the amount of views the game page has?

Adam LaCombe

  • Sr. Member
  • ****
  • Posts: 433
  • Force: +17/-0
    • My Blog
Re: Show Top Game On Left Side!!!
« Reply #11 on: September 04, 2009, 03:39:08 PM »
Code: [Select]
    <table cellpadding="0" cellspacing="0" width="100%">
              <tr>
                <td class="header2">Random Game</td>
              </tr>
              <tr>
                <td class="content2"><?php

$r 
$db->query(sprintf('SELECT * FROM dd_games ORDER BY RAND() DESC LIMIT 0,1'));
echo 
'<table width=\'100%\' border=\'0\' align=\'center\'>
<tr>
</tr>'
;
$count 0;
while(
$in $db->fetch_row($r)){
$gamename ereg_replace('[^A-Za-z0-9]'''$in['name']);
if($seo_on == 1){
$playlink ''.$domain.'/play/'.$in['ID'].'-'.$gamename.'.html';
}else{
$playlink ''.$domain.'/index.php?action=play&amp;ID='.$in['ID'].'';
}
if(
$count%2==0){

       echo 
'<tr>
       <td width=\'50%\' valign=\'top\'>
      
       <table width=\'100%\' border=\'0\'>
       <tr>
       <td valign=\'top\' colspan=\'2\' class=\'header\' style="background-color:#F2F2F2;border-bottom:0px;"><center><b>'
.$in['name'].'</b></center></td>
       </tr>
<tr>
<td>

</td>
</tr>
       <tr>
       <td width=\'55\' height=\'55\' valign=\'top\' class=\'content5\'>
       <a href=\''
.$playlink.'\'>
       '
;
       if($in['type'] == 1){
       echo ' <img src=\''.$domain.'/'.$thumbsfolder.'/'.$in['thumb'].'\' width=\'55\' height=\'55\' border=\'1px solid #000000\'>';
       }else{
       echo ' <img src=\''.$in['thumburl'].'\' width=\'55\' height=\'55\' border=\'0\'>';
       }
      
       echo ' </a>
       </td> <td>
       <a href=\''
.$playlink.'\' class=\'playlink\'><b>Click to Play</b><br />Plays: '.$in['views'].'</a></td>
       </tr>
       </table>
</td>
'
;
}else{
 echo 
'';
}
$count++;
}
echo 
"</table>";
?>
&nbsp;</td>
              </tr>
            </table>

AlvinLee

  • Newbie
  • *
  • Posts: 9
  • Force: +0/-0
    • Free Online Flash Games
Re: Show Top Game On Left Side!!!
« Reply #12 on: June 24, 2010, 05:29:46 AM »
Hello
I try to put code to my page, and Top Game is showing, but can`t open any game. It`s communication : "Game not exist".
Can somebody let me know what is wrong ?

kirdy

  • Newbie
  • *
  • Posts: 17
  • Force: +2/-0
Re: Show Top Game On Left Side!!!
« Reply #13 on: June 25, 2010, 02:04:41 AM »
Whats the url ?

AlvinLee

  • Newbie
  • *
  • Posts: 9
  • Force: +0/-0
    • Free Online Flash Games
Re: Show Top Game On Left Side!!!
« Reply #14 on: June 25, 2010, 02:37:42 AM »
url is games.barchanek.pl I not use Top Game now cause it not work 4 me now.