3
I think Ive found the problem.
What if i have several blocks of php scripting mixed with plain html i want to put into the website block?
This is the code:
-
<?php
$vwar_xroot= "absolute path";
$numnextactions= 3;
$showparticipants = 1;
$showirc = 1;
$include = 0;
if( !defined ("VWAR_COMMON_INCLUDED") )
{
$vwar_root = $vwar_xroot;
require_once ($vwar_root . "includes/functions_common.php");
}
if ( $include == 1 )
{
include_once ($vwar_root . "_header.php");
}
updateRepeatingDatelines("vwar".$n, "warid", "dateline", 1, $waroverlap);
?>
<table border="0" cellpadding="0" cellspacing="0" align="center">
<?php
$dateline = (time() - ($waroverlap * 60)) + ($timezoneoffset * 3600);
if (!defined("VWAR_WARS_FROMNOW"))
{
define("VWAR_WARS_FROMNOW", 1);
$result = $vwardb->query_first("
SELECT COUNT(warid) AS numwars
FROM vwar".$n."
WHERE status = '0'
AND dateline > '$dateline'
" . getPublicMatchtypes(1)
);
$num_nextwars = $result['numwars'];
}
if ($num_nextwars > 0)
{
$result=$vwardb->query("
SELECT vwar".$n.".warid, vwar".$n.".gameid, vwar".$n.".gametypeid, vwar".$n.".matchtypeid, status, vwar".$n.".dateline,
oppnameshort, oppircnetwork, oppircchannel, playerperteam, vwar".$n.".oppid, matchtypename, gametypename,
gameicon,gamenameshort
FROM vwar".$n.", vwar".$n."_matchtype, vwar".$n."_gametype, vwar".$n."_opponents, vwar".$n."_games
WHERE vwar".$n.".oppid = vwar".$n."_opponents.oppid
AND vwar".$n.".gametypeid = vwar".$n."_gametype.gametypeid
AND vwar".$n."_matchtype.matchtypeid = vwar".$n.".matchtypeid
AND status = '0' AND vwar".$n.".dateline > '$dateline'
AND vwar".$n.".gameid = vwar".$n."_games.gameid
" . getPublicMatchtypes(1) . "
GROUP BY vwar".$n.".warid
ORDER BY dateline ASC
LIMIT 0, $numnextactions
");
while ($row = $vwardb->fetch_array($result))
{
dbSelect ($row);
if ($row['gameicon'] != "" && file_exists($vwar_root . "images/gameicons/".$row['gameicon']))
{
$gameicon = makeimgtag($urltovwar . "images/gameicons/".$row['gameicon'], $row['gamename']);
}
else
{
$gameicon = "";
}
?>
<tr>
<td align="center">
<?php echo $gameicon; ?>
<!-- gamenameshort start
<?php echo $row['gamenameshort']; ?>:
gamenameshort end -->
<a href="<?php echo $ownhomepage; ?>" target="_blank">
<?php echo $ownnameshort; ?></a> vs. <a href="<?php echo $urltovwar; ?>war.php?action=oppinfo&oppid=<?php echo $row['oppid']; ?>"><?php echo $row['oppnameshort']; ?></a>
</td>
</tr>
<tr>
<td>» <?php echo date($longdateformat, $row['dateline']); ?></td>
</tr>
<!-- details start
<tr>
<td>» <?php echo $row['matchtypename']; ?></td>
</tr>
<tr>
<td>» <?php echo $row['gametypename']; ?></td>
</tr>
details end -->
<?php
if ($showirc == 1 && !empty($row['oppircnetwork']) && !empty($row['oppircchannel']))
{
?>
<tr>
<td>» IRC: <a href="irc://<?php echo $row['oppircnetwork']; ?>/<?php echo $row['oppircchannel']; ?>"><?php echo $row['oppircchannel']; ?></a></td>
</tr>
<?php
}
if ($showparticipants == 1)
{
$result2 = $vwardb->query_first("
SELECT COUNT(partid) AS parts
FROM vwar".$n."_participants
WHERE available = '1'
AND warid = '" . $row['warid'] . "'
");
$parts = $result2['parts'];
?>
<tr>
<td>» Participants: <font color="<?php echo ($parts >= $row['playerperteam']) ? "green" : "red"; ?>"><?php echo $parts." / ".$row['playerperteam']; ?></font></td>
</tr>
<?php
}
?>
<tr>
<td>» <a href="<?php echo $urltovwar; ?>war.php?action=nextaction&formgame=<?php echo $row['gameid']."#".$row['warid']; ?>">details</a><br><br></td>
</tr>
<?php
}
$vwardb->free_result($result);
}
else
{
?>
<tr>
<td align="center">No Next Actions</td>
</tr>
<?php
}
?>
</table>
<?php
if ($include == 1)
{
include_once ($vwar_root . "_footer.php");
}
?>
Anyways its funny because when i copy this text into the block source code and i choose HTML, when i preview it i can see the block working perfectly. When I sumbmit the source code to the DB i cant view the block in the main page as it should show.