Basic PHP Programming

Your guide to basic PHP Programming

How to create news feeds. (part III)

without comments

1.gif

You are actually halfway through by the time you’re reading this post. If you have religiously done the previous instructions correctly, expect that you will soon have a news feed of your own. Your index.php page serves as your window, so basically, it is just like an interface. What you need to make is an HTML page full of tables (but not too many) so as just to separate the news from each other. And then you have to make use of this coding to shorten and convert lines into a string:

$list = getNewsList();
foreach ($list as $value) {
$newsData = file(“news/”.$value);
$newsTitle = $newsData[0];
$submitDate = $newsData[1];
unset ($newsData['0']);
unset ($newsData['1']);

$newsContent = “”;
foreach ($newsData as $value) {
$newsContent .= $value;
}

echo “$newsTitle
$submitDate”;
echo “”.$newsContent.

________________________________________
“;
}
?>

Photo taken from http://geology.com

Written by editor

May 13th, 2008 at 10:52 am

Posted in Information