Problemet kan ses her:
http://197.dk/nyhed/index.phpKODEN I FILEN DER VISER NYHEDERNE:
<?php
$list = getNewsList();
foreach ($list as $value) {
$newsData = file("news/".$value);
$newsTitle = $newsData[0];
$submitDate = $newsData[1];
$newsLink = $newsData[3];
$newsIni = $newsData[2];
unset ($newsData['0']);
unset ($newsData['1']);
unset ($newsData['2']);
unset ($newsData['3']);
$newsContent = "";
foreach ($newsData as $value) {
$newsContent .= $value;
}
echo "<tr><th align='left'><a target='_blank' href='$newsLink'>$newsTitle</a></th><th align='right'><span class='dato'>".$submitDate."</span><span class='ini'>".$newsIni."</span></th></tr>";
echo "<tr><td colspan='2'><span class='tekst'>".$newsContent."</span><hr size='1'/></td></tr>";
}
?>
KODEN I FILEN DER OPRETTET NYHEDER:
<script language="javascript" type="text/javascript" src="js/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
});
</script>
</head>
<body>
<div id="main">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<span class="mellem">Overskrift:</span> <input type="text" name="title" size="40"/><br/>
<br/><div id="mellem">URL:</div>
<input type="text" name="link" size="40"/><br/>
<br/><div id="mellem">Tilføjet af:</div>
<select name="ini">
<option value="" selected="selected">Vælg...</option>
<option value="DB1">Person1</option>
<option value="DB2">Person2</option>
<option value="DB3">Person3</option>
</select>
<br/><br/>
<div id="mellem">Kommentar:</div>
<textarea name="newstext" rows="6" cols="40"></textarea><br/>
<center><input type="submit" name="submit" value="Tilføj" /></center>
</form>
<div id="source"><a href="index.php">Tilbage til nyheder</a></div>
</div>
</body>
<?php } else {
$newsTitel = isset($_POST['title']) ? $_POST['title'] : 'Untitled';
$newsIni = isset($_POST['ini']) ? $_POST['ini'] : 'Intet link';
$newsLink = isset($_POST['link']) ? $_POST['link'] : 'Intet link';
$submitDate = date('G:i d-m-y');
$newsContent = isset($_POST['newstext']) ? $_POST['newstext'] : 'No content';
$newsLink2 = $newsLink;
if (substr($newsLink2, 0, 7) != '
http://')
{
$newsLink2 = '
http://' . $newsLink2;
}
$filename = date('YmdHis');
$f = fopen('news/'.$filename.".txt","w+");
fwrite($f,$newsTitel."\n");
fwrite($f,$submitDate."\n");
fwrite($f,$newsIni."\n");
fwrite($f,$newsLink2."\n");
fwrite($f,$newsContent."\n");
fclose($f);
header('Location:index.php');
}
?>
CSS STYLEN:
A:link {
font-family: Arial, Helvetica, sans-serif;
font-size : 12px;
color:#F28F03;
text-decoration: none;
}
A:hover {
font-family: Arial, Helvetica, sans-serif;
font-size : 12px;
color:#000000;
text-decoration: none;
}
A:visited {
font-family: Arial, Helvetica, sans-serif;
font-size : 12px;
color:#F28F03;
text-decoration: none;
}