Citaat van thibo
Aaron, het is de bedoeling dat crew ook kan posten?
dus uit het adminpanel zo te verstaan.
mvg Thibo
Natuurlijk is dat mogelijk... Dus je leest het kieuws uit de database op datum..
Dan gewoon op je admin paneel een funtie maken voor nieuws toe te voegen...
hierbij een voorbeeld:
MYSQL:
CREATE TABLE IF NOT EXISTS `nieuws` (
`id` int(11) NOT NULL auto_increment,
`type` enum('update','nieuws','aanpassing','informatie') NOT NULL,
`date` date NOT NULL,
`item` text NOT NULL,
`titel` varchar(250) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
NIEUWS SCRIPT:
<table border='0' cellspacing='1' width='96%' bgcolor='#000' align="center">
<tr>
<td class='top'>
Nieuws Berichten
</td>
</tr>
<?php
$sql = mysql_query("SELECT *, DATE_FORMAT(`date`, '%d-%m-%Y') AS `date` FROM `nieuws` ORDER BY `id` DESC LIMIT 0, 5") or die(mysql_error());
while($res = mysql_fetch_assoc($sql)){
?>
<tr>
<td class='inhoud'>
<span class='<?=$res['type']; ?>'><?=ucfirst($res['type']); ?>:</span> <span class='nieuwsitem'><?=$res['titel']; ?></span>
<br />
<span style='color: #8e8e8e;'><?=$res['date']; ?></span><br />
<?=nl2br($res['item']); ?>
</td>
</tr>
<?
}
?>
</table>
Toon Meer
VOOR DE BEHEERDERS ( nieuws kunnen toevoegen, goed beveilligen...):
<?php
echo "<form method='post' action='".$_SERVER['REQUEST_URI']."'>";
if(isset($_POST['post'])){
$reps = array("noscript", "<script", "</script>");
$bericht = str_replace($reps, "", $_POST['bericht']);
mysql_query("INSERT INTO `nieuws` (`type`, `date`, `titel`, `item`) VALUES (".$_POST['type'].", '".date("Y-m-d")."', '".($_POST['titel'])."', '".($bericht)."')") or die(mysql_error());
echo "Nieuws item geplaatst!";
} else {
echo "Titel: <input type='text' name='titel' value='' maxlenght='250' size='75'><br><br>";
echo "Type: <select name='type'><option value='1'>Update</option>
<option value='2'>Nieuws</option>
<option value='3'>Aanpassing</option>
<option value='4'>Informatie</option></select><br><br>";
echo "<table><tr><td style='vertical-align: top;'>Bericht:</td><td> <textarea name='bericht'></textarea></td></tr></table><br>";
echo "<input type='submit' name='post' value='Plaatsen!'>";
}
echo "</form>";
?>
Toon Meer
en als laatste CSS:
span.nieuws {
font-size: 20px;
color: #4db5d6;
}
span.update {
font-size: 20px;
color: #f7ff15;
}
span.informatie {
font-size: 20px;
color: #39de00;
}
span.aanpassing{
font-size: 20px;
color: #ff0000;
}
span.nieuwsitem {
font-size: 20px;
color: #adadad;
}
Toon Meer