<?php
// this script is setup by MAX232, also known as LOWERMOWER
// it is NOT copyrighted so you may alter what you like
// if you're lucky I may help you when you f*&#@$ it up
// create a table with the following cells
// id (INT) unique
// name (varchar 30) use this as a unique name in case you want to add a searchengine along the way
// title (varchar 60) use this as the description title for display above item
// preface (TINYTEXT) use this as opening paragraph
// entry (TEXT) use this as main textfield
// IMPORTANT, use the id to order so a new item MUST have a higher id then the last one
// a content management panel will do this for you, myPhpAdmin will not
// setup database variables
// databasename
$bcp_dbname = "dbnamehere";
// database username
$bcp_dbuser = "username";
// database password
$bcp_dbpass = "password";
// database host (usual localhost)
$bcp_dbhost = "localhost";
// database tabel which contains the newsitems
$bcp_dbtable = "table";
// number of messages you want displayed from the entire archive
$bcp_mcount = "5";
mysql_connect($bcp_dbhost, $bcp_dbuser, $bcp_dbpass);
mysql_select_db($bcp_dbname);
$news_item = @mysql_query("SELECT * FROM {$bcp_dbtable} ORDER by 'id' DESC");
$bcp_mcount = $bcp_mcount +1;
// setup loop to retrieve all available newspages
// setup count var to make sure you can determine how many messages are displayed
echo ("<div class=\"title\"><h3>Nieuws...</h3></div>");
$news_count = 0;
while($news_row = mysql_fetch_array($news_item)) {
$news_title = $news_row["title"];
$news_id = $news_row["id"];
$news_count = $news_count+1;
if($news_count < $bcp_mcount) {
// start display item
// 55 in the second row from here is the number of characters you want to display of the original message
echo ( "<p>|| " . $news_row["title"] . "<br>");
echo ( "" . substr($news_row["preface"], 0, 55) . "...<br>");
echo ("<a href=\"index.php?id=$news_id\" class=\"white\" target=\"_self\">Lees meer »»</a></p>");
// end display item
} else {
echo ("");
}
}
?>