TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 18, 2024, 03:59:13 PM

Login with username, password and session length
Members
  • Total Members: 3,886
  • Latest: Grendor
Stats
  • Total Posts: 195,189
  • Total Topics: 21,220
  • Online today: 112
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 60
  • Total: 60

Pulling in high scores from smfarcade into a block. Has anybody tried this?

Started by houston, November 08, 2005, 03:43:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

IchBin

If the static page can use PHP just add echo '<iframe>';
echo '</iframe>';
where you need to.

Ray

tried this but get a blank page

Quote<?php
echo '<iframe>';   
require('./Settings.php');

$top = highscore();
   //echo "
".print_r($top,true)."
";

   foreach($top as $temp){
   
   echo"<table align=\"center\" width=\"50%\"><tr><td align=\"center\" class=\"smalltext\">{$temp['realName']}</td></tr>";
      echo "<tr><td align=\"center\" class=\"smalltext\">{$temp['name']} - {$temp['score']}</td></tr><tr><td width=\"50%\">
</td></tr></table>";
   }
function highscore($count = 30, $game = "", $cutoff = 0)
{
   global $link,$db_prefix,$boarddir,$boardurl;
   
   if($game == "")
   $query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER ORDER BY score DESC LIMIT 0,{$count}";
   else
   $query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER AND {$db_prefix}games.game='{$game}' ORDER BY score DESC LIMIT 0,{$count}";
   $res = mysql_query($query) or die(mysql_error());
   $top = array();
   while($x = mysql_fetch_array($res))
   {
      $x['score'] = (string)$x['score'];
      $top[] = $x;

   }
   return $top;
}
echo '</iframe>';
?>

IchBin

You may want to move the iframe tags to surround your HMTL code, not the whole PHP code. And if you're running this in TP in an article or block you don't need the php tags. I don't have the arcade or I would test this to make sure it works.  Try this:

   
require('./Settings.php');

$top = highscore();
   //echo "

".print_r($top,true)."

";

   foreach($top as $temp){
echo '<iframe>';   
   echo"<table align=\"center\" width=\"50%\"><tr><td align=\"center\" class=\"smalltext\">{$temp['realName']}</td></tr>";
      echo "<tr><td align=\"center\" class=\"smalltext\">{$temp['name']} - {$temp['score']}</td></tr><tr><td width=\"50%\"></td></tr></table>";
echo '</iframe>';
   }
function highscore($count = 30, $game = "", $cutoff = 0)
{
   global $link,$db_prefix,$boarddir,$boardurl;
   
   if($game == "")
   $query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER ORDER BY score DESC LIMIT 0,{$count}";
   else
   $query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER AND {$db_prefix}games.game='{$game}' ORDER BY score DESC LIMIT 0,{$count}";
   $res = mysql_query($query) or die(mysql_error());
   $top = array();
   while($x = mysql_fetch_array($res))
   {
      $x['score'] = (string)$x['score'];
      $top[] = $x;

   }
   return $top;
}

winrules

Quote from: snork13 on November 19, 2005, 07:42:42 PM
ok, this will pull the highscores from smfarcade into a php block. So you will need a need php block ;D and in the function highscore($count = 5, $game = "", $cutoff = 0)

// highscore( int [count=10], str [game internal name], int [cutoff older than] )

require('./Settings.php');

$top = highscore();
//echo "<pre>".print_r($top,true)."</pre>";

foreach($top as $temp){

echo"<table align=\"center\" width=\"100%\"><tr><td align=\"center\" class=\"smalltext\">{$temp['realName']}</td></tr>";
echo "<tr><td align=\"center\" class=\"smalltext\">{$temp['name']} - {$temp['score']}</td></tr><tr><td width=\"100%\"><hr></td></tr></table>";
}
function highscore($count = 5, $game = "", $cutoff = 0)
{
global $link,$db_prefix,$boarddir,$boardurl;

if($game == "")
$query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER ORDER BY score DESC LIMIT 0,{$count}";
else
$query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER AND {$db_prefix}games.game='{$game}' ORDER BY score DESC LIMIT 0,{$count}";
$res = mysql_query($query) or die(mysql_error());
$top = array();
while($x = mysql_fetch_array($res))
{
$x['score'] = (string)$x['score'];
$top[] = $x;

}
return $top;
}


thank to Niko (mod authur) for the help

I tried that and it works but whenever I'm in side the arcade it gives this error:
Fatal error: Cannot redeclare highscore() (previously declared in /public_html/other/Sources/Arcade2.php:281) in /public_html/other/Sources/Load.php(1598) : eval()'d code(32) : eval()'d code on line 11

houston

Quote from: winrules on December 09, 2005, 03:06:55 PM
Quote from: snork13 on November 19, 2005, 07:42:42 PM
ok, this will pull the highscores from smfarcade into a php block. So you will need a need php block ;D and in the function highscore($count = 5, $game = "", $cutoff = 0)

// highscore( int [count=10], str [game internal name], int [cutoff older than] )

require('./Settings.php');

$top = highscore();
//echo "<pre>".print_r($top,true)."</pre>";

foreach($top as $temp){

echo"<table align=\"center\" width=\"100%\"><tr><td align=\"center\" class=\"smalltext\">{$temp['realName']}</td></tr>";
echo "<tr><td align=\"center\" class=\"smalltext\">{$temp['name']} - {$temp['score']}</td></tr><tr><td width=\"100%\"><hr></td></tr></table>";
}
function highscore($count = 5, $game = "", $cutoff = 0)
{
global $link,$db_prefix,$boarddir,$boardurl;

if($game == "")
$query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER ORDER BY score DESC LIMIT 0,{$count}";
else
$query = "SELECT * FROM {$db_prefix}games,{$db_prefix}games_high,{$db_prefix}members WHERE {$db_prefix}games.game={$db_prefix}games_high.game AND {$db_prefix}games_high.member={$db_prefix}members.ID_MEMBER AND {$db_prefix}games.game='{$game}' ORDER BY score DESC LIMIT 0,{$count}";
$res = mysql_query($query) or die(mysql_error());
$top = array();
while($x = mysql_fetch_array($res))
{
$x['score'] = (string)$x['score'];
$top[] = $x;

}
return $top;
}


thank to Niko (mod authur) for the help

I tried that and it works but whenever I'm in side the arcade it gives this error:
Fatal error: Cannot redeclare highscore() (previously declared in /public_html/other/Sources/Arcade2.php:281) in /public_html/other/Sources/Load.php(1598) : eval()'d code(32) : eval()'d code on line 11

I have the same error in the arcade. I had just upraded to the latest version and noticed it there. I have since removed the block until I had time to solve the problem.

core

any answer found on this subject yet?

Fatal error: Cannot redeclare highscore() (previously declared in /home/resellers/xxxx/xxxxx/corenation.com/www/smf/Sources/Arcade2.php:281) in /home/resellers/xxxxx/xxxx/corenation.com/www/smf/Sources/Load.php(1607) : eval()'d code(34) : eval()'d code on line 11

houston

Quote from: core on January 24, 2006, 04:47:04 PM
any answer found on this subject yet?

Fatal error: Cannot redeclare highscore() (previously declared in /home/resellers/xxxx/xxxxx/corenation.com/www/smf/Sources/Arcade2.php:281) in /home/resellers/xxxxx/xxxx/corenation.com/www/smf/Sources/Load.php(1607) : eval()'d code(34) : eval()'d code on line 11


Not yet. Unless someone has found a solution and has not posted it yet.

Xarcell

They upgraded thier site today and installed TP on it. So it's just a matter of time before they write a script that allows that.


technodragon73