SimplePortal
Support => English Support => Topic started by: pinklady on May 14, 2010, 11:42:40 AM
-
Hi all :D
First of all thanks for the update for Simpleportal! :thumbsup: :D
Everything seems to work fine, but i do have errors in my admin log:
8: Undefined variable: curr_position
File: forum/Themes/default/languages/SPortalAdmin.english.php (main_above sub template - eval?)
Line: 320
8: Undefined variable: curr_position
File: forum/Themes/default/languages/SPortalAdmin.english.php (main_above sub template - eval?)
Line: 313
8: Undefined variable: curr_position
File: forum/Themes/default/PortalArticles.template.php (portal_above sub template - eval?)
Line: 33
8: Undefined variable: curr_position
File: /forum/Themes/default/PortalArticles.template.php (portal_above sub template - eval?)
Line: 43
8: Undefined variable: curr_position
File: /forum/Themes/default/PortalArticles.template.php (portal_above sub template - eval?)
Line: 32
8: Undefined variable: curr_position
File: forum/Themes/default/PortalArticles.template.php (main_above sub template - eval?)
Line: 320
8: Undefined variable: curr_position
File: forum/Themes/default/PortalArticles.template.php (main_above sub template - eval?)
Line: 313
I use SimplePortal 2.3.2 and SMF 1.1.11.
Does this maybe have to do with my custom php blocks? I will post them here, because maybe that is the problem and maybe you can help me then to fix it :angel: :D
Block 1
global $db_prefix, $scripturl, $txt, $modSettings, $boardurl;
/********START EDITS******************************/
$no=12; //you can change this to the amount of games you want
$icons_per_row = 6; //you can change this to the amount of rows you want
/********END EDITS********************************/
if (empty($modSettings['down_url']))
{
$modSettings['down_url'] = $boardurl . '/downloads/';
}
echo '<table class="tborder" cellpadding="2" cellspacing="0">
<th class="titlebg" colspan="'.$icons_per_row.'">Latest Downloads</th>
<tr>';
$query = "SELECT p.ID_FILE, p.fileimage, p.commenttotal, p.totalratings, p.rating, p.filesize, p.views, p.title, p.ID_MEMBER, m.realName, p.date, p.description
FROM {$db_prefix}down_file as p
LEFT JOIN {$db_prefix}members AS m ON (m.ID_MEMBER = p.ID_MEMBER)
WHERE p.approved = 1 ORDER BY p.ID_FILE DESC LIMIT 0,{$no}";
$dbresult = db_query($query, __FILE__, __LINE__);
while($row = mysql_fetch_assoc($dbresult))
{
if($curr_position == $icons_per_row)
{
echo '</tr><tr>';
$curr_position=0;
}
echo '<td class="windowbg" align="center">
<a href="' . $scripturl . '?action=downloads;sa=view;id=' . $row['ID_FILE'] . '"><img src="downloads/fileimgs/' .$row['fileimage']. '" width="50px" height="50px" alt="',$row['title'],'" title="',$row['title'],'"></a></td>'; $curr_position++;
}
echo '
</tr></table><br />';
// Free the Mysql resource
mysql_free_result($dbresult);
Block 2
include_once('SSI.php');
require('Settings.php');
require_once($sourcedir.'/ArcadeDbConnector.php');
require_once($sourcedir.'/ArcadeStats.php');
$link = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name, $link);
global $scripturl,$db_prefix,$gamesUrl;
/********START EDITS******************************/
$no=10; //you can change this to the amount of games you want
/********END EDITS********************************/
$gamesUrl = 'Games/';
//show latest games
echo '<table cellpadding="2" cellspacing="0">
<tr>';
$sql = "SELECT id_game, game_name, thumbnail, game_directory
FROM {$db_prefix}arcade_games
ORDER BY id_game DESC , game_name ASC LIMIT 0,{$no}";
$result = db_query($sql,__FILE__,__LINE__);
while($game = mysql_fetch_array($result))
{
$game_thumb = !$game['game_directory'] ? $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail'];
if($curr_position == 1)
{
echo '</tr><tr>';
$curr_position=0;
}
echo'
<td>
<a href="'.$scripturl.'?action=arcade;sa=play;game='.$game['id_game'].'" target="_blank">
<img src="'.$game_thumb.'" border="0" alt="'.$game['game_name'].'" width="25" height="25" title="Play '.$game['game_name'].'"/></a>
</td><td><a href="'.$scripturl.'?action=arcade;sa=play;game='.$game['id_game'].'" target="_blank"><font class="smalltext">'.$game['game_name'].'</font></a></td>';
$curr_position=1;
}
mysql_free_result($result);
echo '
</tr>
</table></div>';
Block 3
include_once('SSI.php');
require('Settings.php');
require_once($sourcedir.'/ArcadeDbConnector.php');
require_once($sourcedir.'/ArcadeStats.php');
$link = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name, $link);
global $scripturl,$db_prefix,$gamesUrl;
/********START EDITS******************************/
$no=9; //you can change this to the amount of games you want
$icons_per_row = 3; //you can change this to the amount of rows you want
/********END EDITS********************************/
$gamesUrl = 'Games/';
//show random games
echo '<table cellpadding="2" cellspacing="0" align="center">
<tr>';
$sql = "SELECT id_game, game_name, thumbnail, game_directory
FROM {$db_prefix}arcade_games
ORDER BY RAND() LIMIT 0,{$no}";
$result = db_query($sql,__FILE__,__LINE__);
while($game = mysql_fetch_array($result))
{
$game_thumb = !$game['game_directory'] ? $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail'];
if($curr_position == $icons_per_row)
{
echo '</tr><tr>';
$curr_position=0;
}
echo'
<td>
<a href="'.$scripturl.'?action=arcade;sa=play;game='.$game['id_game'].'" target="_blank">
<img src="'.$game_thumb.'" border="0" alt="'.$game['game_name'].'" width="45" height="45" title="Play '.$game['game_name'].'"/></a>
</td>';
$curr_position++;
}
mysql_free_result($result);
echo '
</tr>
</table></div>';
Block 4
include_once('SSI.php');
require('Settings.php');
require_once($sourcedir.'/ArcadeDbConnector.php');
require_once($sourcedir.'/ArcadeStats.php');
$link = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name, $link);
global $scripturl,$db_prefix,$gamesUrl;
/********START EDITS******************************/
$no=10; //you can change this to the amount of games you want
/********END EDITS********************************/
$gamesUrl = 'Games/';
//show most played games
echo '<table cellpadding="2" cellspacing="0">
<tr>';
$sql = "SELECT id_game, game_name, thumbnail, game_directory
FROM {$db_prefix}arcade_games
ORDER BY number_plays DESC , game_name ASC LIMIT 0,{$no}";
$result = db_query($sql,__FILE__,__LINE__);
while($game = mysql_fetch_array($result))
{
$game_thumb = !$game['game_directory'] ? $gamesUrl.$game['thumbnail'] : $gamesUrl.$game['game_directory']."/".$game['thumbnail'];
if($curr_position == 1)
{
echo '</tr><tr>';
$curr_position=0;
}
echo'
<td>
<a href="'.$scripturl.'?action=arcade;sa=play;game='.$game['id_game'].'" target="_blank">
<img src="'.$game_thumb.'" border="0" alt="'.$game['game_name'].'" width="25" height="25" title="Play '.$game['game_name'].'"/></a>
</td><td><a href="'.$scripturl.'?action=arcade;sa=play;game='.$game['id_game'].'" target="_blank"><font class="smalltext">'.$game['game_name'].'</font></a></td>';
$curr_position=1;
}
mysql_free_result($result);
echo '
</tr>
</table>';
Greets,
Pinklady :nervous-happy:
-
Yes. There is an error in php block #1. Somehow, SMF gets very confused while trying to evaluate the bad code in your custom php block, and reports that the error came from a completely irrelevant file name.
It is trying to check the value of $curr_position, but it has never set the value of $curr_position. Presumably, its value should start at 0.
while($row = mysql_fetch_assoc($dbresult))
$cur_position = 0;
while($row = mysql_fetch_assoc($dbresult))