Page 1 of 1

News index / Submit files

Posted: Sat Apr 05, 2003 1:05 pm
by Dragonsimoto
I have had problems thinking how i would go about this.

I want to have an index that fgetss() so many bytes(undecided) of the 5 latest news submits in the articles directory. And i would want the article to have a picture that would go with the article on the index as well.

On the submit page, i would allow uploading to /articles, of .jpg and .html articles, which would be parsed with index's fgetss....

The problem i am thinking of is How would i go about keeping track of the latest five submits? How would i know the .jpg and .html file to load on index.php dynamically? I dont want to use a DB (MySQL) for this site since it is for a friend, and he wont have access to MySQL.

THanks alot guys,
Clark Askam Dragonsimoto

Posted: Sat Apr 05, 2003 8:48 pm
by McGruff
If the files are named with a timestamp (or any sequential number) you could use readdir() to find the latest filenames - perhaps by building an array of filenames and then doing a sort().

You could even manage it manually by ftp (saves some script overhead): ie only ever keep the latest five files in a "latest" folder.

Could name jpg's the same as the file for easy linking.

Create a single html template and include it in your script, echo'ing out (in the template) <?php echo $text; ?> and <img src="path/to/file/<?php echo $filename; ?>.jpg">.

Just some basic ideas - have to admit I'm more used to working with mysql than with files.

Posted: Sun Apr 06, 2003 11:15 pm
by Dragonsimoto
Thanks,

I thought about rotating the files out of a "latest" directory, then to a "old" one.

I will probably do that, then i wont have to deal with a news posting script...Just a readdir() then take whatever is there and fgetss(somenum) for each html file. then use some variable control like you stated for the jpg's.

Thanks alot,
Dragon/Clark