PDA

View Full Version : php/sql as the header


Hexelon
01-29-2007, 10:41 AM
I want to replace the standard header with a custom one, how would I get this to work in the header.


<?php

include ("config.php");

$gi = mysql_query("SELECT * FROM `gameinfo`");
while($gameinfo = mysql_fetch_object($gi)) {

echo"<div id='topstrip'>
<table class='sborder' cellpadding='4' cellspacing='0' width='965px'>

<tr>
<td height='20px' width='750px'></td>
<td height='20px' width='5px'></td>
<td height='20px' width='180px'></td>
<td height='20px' width='20px'></td>
</tr>
<tr>
<td class='statusspacer' width='750px'></td>
<td class='maplineleft' width='5px'></td>
<td class='mapline' width='180px'>Map: $gameinfo->map</td>
<td class='maplineright' width='20px'></td>
</tr>
<tr>
<td height='5px' width='750px'></td>
<td height='5px' width='5px'></td>
<td height='5px' width='180px'></td>
<td height='5px' width='20px'></td>
</tr>
<tr>
<td class='statusspacer' width='750px'></td>
<td class='gdilineleft' width='5px'></td>
<td class='gdiline' width='180px'><a href='#'>GDI: $gameinfo->gdi - $gameinfo->gdiscore points</a></td>
<td class='gdilineright' width='20px'></td>
</tr>
<tr>
<td height='5px' width='750px'></td>
<td height='5px' width='5px'></td>
<td height='5px' width='180px'></td>
<td height='5px' width='20px'></td>
</tr>
<tr>
<td class='statusspacer' width='750px'></td>
<td class='nodlineleft' width='5px'></td>
<td class='nodline' width='180px'><a href='#'>Nod: $gameinfo->nod - $gameinfo->nodscore points</a></td>
<td class='nodlineright' width='20px'></td>
</tr>
<tr>
<td height='5px' width='750px'></td>
<td height='5px' width='5px'></td>
<td height='5px' width='180px'></td>
<td height='5px' width='20px'></td>
</tr>
<tr>
<td class='statusspacer' width='750px'></td>
<td class='infolineleft' width='5px'></td>
<td class='infoline' width='180px'>Time: $gameinfo->timeleft SFPS: $gameinfo->sfps</td>
<td class='infolineright' width='20px'></td>
</tr>
</table>
</div>";
}
?>

This is what I have tried so far with no luck:

I make a plugin called gameinfo

include ("status.config.php");

$gi = mysql_query("SELECT * FROM `gameinfo`");
while($gameinfo = mysql_fetch_object($gi)) {
}

I made a template called gameinfo_template

<table class='sborder' cellpadding='4' cellspacing='0' width='965px'>

<tr>
<td height='20px' width='750px'></td>
<td height='20px' width='5px'></td>
<td height='20px' width='180px'></td>
<td height='20px' width='20px'></td>
</tr>
<tr>
<td class='statusspacer' width='750px'></td>
<td class='maplineleft' width='5px'></td>
<td class='mapline' width='180px'>Map: $gameinfo->map</td>
<td class='maplineright' width='20px'></td>
</tr>
<tr>
<td height='5px' width='750px'></td>
<td height='5px' width='5px'></td>
<td height='5px' width='180px'></td>
<td height='5px' width='20px'></td>
</tr>
<tr>
<td class='statusspacer' width='750px'></td>
<td class='gdilineleft' width='5px'></td>
<td class='gdiline' width='180px'><a href='#'>GDI: $gameinfo->gdi - $gameinfo->gdiscore points</a></td>
<td class='gdilineright' width='20px'></td>
</tr>
<tr>
<td height='5px' width='750px'></td>
<td height='5px' width='5px'></td>
<td height='5px' width='180px'></td>
<td height='5px' width='20px'></td>
</tr>
<tr>
<td class='statusspacer' width='750px'></td>
<td class='nodlineleft' width='5px'></td>
<td class='nodline' width='180px'><a href='#'>Nod: $gameinfo->nod - $gameinfo->nodscore points</a></td>
<td class='nodlineright' width='20px'></td>
</tr>
<tr>
<td height='5px' width='750px'></td>
<td height='5px' width='5px'></td>
<td height='5px' width='180px'></td>
<td height='5px' width='20px'></td>
</tr>
<tr>
<td class='statusspacer' width='750px'></td>
<td class='infolineleft' width='5px'></td>
<td class='infoline' width='180px'>Time: $gameinfo->timeleft SFPS: $gameinfo->sfps</td>
<td class='infolineright' width='20px'></td>
</tr>
</table>

and in the header I put

<div id='topstrip'>
$gameinfo_template
</div>

Eric
01-29-2007, 12:53 PM
Try

Plugin:

include('./status.config.php');
//$gi = $db->query_read("SELECT * FROM gameinfo");
$gameinfo = $db->query_first("SELECT * FROM gameinfo");

eval('$gameinfo_template = "' . fetch_template('gameinfo_template') . '";');


gameinfo_template

<table class='sborder' cellpadding='4' cellspacing='0' width='965px'>
<tbody>
<tr>
<td height='20px' width='750px'></td>
<td height='20px' width='5px'></td>
<td height='20px' width='180px'></td>
<td height='20px' width='20px'></td>
</tr>
<tr>
<td class='statusspacer' width='750px'></td>
<td class='maplineleft' width='5px'></td>
<td class='mapline' width='180px'>Map: $gameinfo[map]</td>
<td class='maplineright' width='20px'></td>
</tr>
<tr>
<td height='5px' width='750px'></td>
<td height='5px' width='5px'></td>
<td height='5px' width='180px'></td>
<td height='5px' width='20px'></td>
</tr>
<tr>
<td class='statusspacer' width='750px'></td>
<td class='gdilineleft' width='5px'></td>
<td class='gdiline' width='180px'><a href='#'>GDI: $gameinfo[gdi] - $gameinfo[gdiscore] points</a></td>
<td class='gdilineright' width='20px'></td>
</tr>
<tr>
<td height='5px' width='750px'></td>
<td height='5px' width='5px'></td>
<td height='5px' width='180px'></td>
<td height='5px' width='20px'></td>
</tr>
<tr>
<td class='statusspacer' width='750px'></td>
<td class='nodlineleft' width='5px'></td>
<td class='nodline' width='180px'><a href='#'>Nod: $gameinfo[nod] - $gameinfo[nodscore] points</a></td>
<td class='nodlineright' width='20px'></td>
</tr>
<tr>
<td height='5px' width='750px'></td>
<td height='5px' width='5px'></td>
<td height='5px' width='180px'></td>
<td height='5px' width='20px'></td>
</tr>
<tr>
<td class='statusspacer' width='750px'></td>
<td class='infolineleft' width='5px'></td>
<td class='infoline' width='180px'>Time: $gameinfo[timeleft] SFPS: $gameinfo[sfps]</td>
<td class='infolineright' width='20px'></td>
</tr>
</tbody>
</table>

Hexelon
01-29-2007, 08:30 PM
Thank you