Beste webmasters,
Ik zit met een klein probleempje. Ik ben bezig met een nieuwsscript. Alles werkt op 1 ding na. Als er een plaatje bij het nieuwsbericht is toegevoegd, moet ie deze oproepen dmv een tabel met 2 kollommen. Links $bericht en rechts $afbeelding_name. MAAR als er geen afbeelding is moet ie 1 kollom weergeven met daarin $bericht. Ik heb dit met een if else script gedaan, maar het werkt niet :S
Kan iemand mij helpen? hieronder staat het script:
/// Nieuws.php
<?PHP $bestand=array_reverse(file("nieuws.txt"));
($bestand) ? "" : "Er zijn nog geen berichten!";
foreach($bestand as $i) {
$i=explode("|",$i);
$naam = $i[0];
$titel = $i[1];
$datum = $i[2];
$bericht = $i[3];
$afbeelding_name = $i[4];
$titel = htmlspecialchars($titel);
$naam = htmlspecialchars($naam);
$bericht = htmlspecialchars($bericht);
$afbeelding_name = htmlspecialchars($afbeelding_name);
$bericht = str_replace("<br>","<br>",$bericht); $bericht = str_replace("\'","'",$bericht);
echo"<table width='430' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td><table width='430' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td valign='top'>$titel<br>
</td>
</tr>
</table>";
if ($afbeelding_name == '') {
print "<table width='430' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td valign='top'>$bericht</td>
</tr>
</table>";
}
else
{
echo "<table width='430' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='75%' valign='top'>$bericht</td>
<td width='25%'> <div align='right'>
<table width='25' border='0' cellpadding='1' cellspacing='0' bgcolor='4E4E27'>
<tr>
<td><img src='uploads/$afbeelding_name' border='0' width='125' height='100'></td>
</tr>
</table>
</div></td>
</tr>
</table>";
echo"<table width='430' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td><a href='#top'><br>
<img src='images/pijltje_top.gif' alt='terug naar boven' width='11' height='10' border='0'></a></td>
</tr>
</table>
<table width='430' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td><img src='images/line.gif' width='430' height='1'></td>
</tr>
</table>";
echo"</td>
</tr>
</table>";
}}
?>
/// nieuws.php
op internet: http://www.ranco.name/jurgentest/nieuws_tables.php
Alvast bedankt!
848 views