Ok.. I have a script I wrote that's fairly simple a series of news articles that are in a text file are read then formated by the script. I want to reverse the order of the articles as they appear in the news list (IE most resent is the LAST item in the file). The problem is Arrays do not seem to work quite right.
I read the subject date and author into 3 arrays then the new text into a third (with CRLF's). However when I go through the array I get empty elements from the array.
Some of the data grabing code...
disgorging the data..
This produces nothing but empty articles, however outputing things in the order they are read in works <if not looks ugly>. OK I need to fix the formating issues as the html put out isn't quite right.
What is my main idiocy here?
What am I doing wrong?
Cyb
I read the subject date and author into 3 arrays then the new text into a third (with CRLF's). However when I go through the array I get empty elements from the array.
Some of the data grabing code...
Code:
function showarticle($NewsH)
{
$Poster= fgets($NewsH);
if (!feof($NewsH))
{
$Date= fgets($NewsH);
if (!feof($NewsH))
{
$Title= fgets($NewsH);
if (!feof($NewsH))
{
showhead($Poster, $Date, $Title);
echo "<tr><td valign=\"top\">\r\n";
$Titles[] = $Title;
$Authors[]= $Poster;
$Dates[] = $Date;
disgorging the data..
Code:
echo "<center>\r\n";
echo " <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" valign=\"top\" width=\"95%\">\r\n";
for($Index = $Count-1; $Index > -1; $Index--)
{
showhead(
$Authors[$Index],
$Dates[$Index],
$Subject[$Index]
);
echo " <tr><td valign=\"top\">\r\n";
printf("%d<br>\r\n", $Index);
echo $Texts[$Index];
echo " </tr></td>\r\n";
}
*/
echo " </table>\r\n";
echo "</center>\r\n";
This produces nothing but empty articles, however outputing things in the order they are read in works <if not looks ugly>. OK I need to fix the formating issues as the html put out isn't quite right.
What is my main idiocy here?
Cyb
Last edited: