How to create news feeds. (part I)
If you wish to create a news feed system using php, it is actually easier than you thought. The basic news system comprises of a php editor (for easier editing), an index.php page (where your news will be displayed) and an admin.php page (where you will post the news). You must create first a page using html so that you can make forms embedded into a page. Then you must insert this coding in the head area of the admin page:
Insert name of php editor here.init({ mode : “textareas”, theme : “advanced”,
theme_advanced_buttons3 : “”, theme_advanced_toolbar_location : “top”,
theme_advanced_toolbar_align : “left”,});
All you have to do to make sure that your coding works is to add in the processing field these codes:
$newsTitel = isset($_POST['title']) ? $_POST['title'] : ‘Untitled’;
$submitDate = date(‘Y-m-d g:i:s A’);
$newsContent = isset($_POST['newstext']) ? $_POST['newstext'] : ‘No content’;
$filename = date(‘YmdHis’);
$f = fopen(‘news/’.$filename.”.txt”,”w+”);
fwrite($f,$newsTitel.”\n”);
fwrite($f,$submitDate.”\n”);
fwrite($f,$newsContent.”\n”);
fclose($f);
header(‘Location:index.php’);
?>
Photo taken from http://blog2.protopage.com
