Sublime directory Surf the web anonymous Pagerank Monitor


Listing Latest Entries in Homepage

vbignacio
Thu 15 November 2007, 01:39 am GMT +0100
How can I list my latest articles, located in different directories, in my homepage? Is there a php script for it? What is it called?

olaf
Thu 15 November 2007, 09:37 am GMT +0100
I think you need to query your database, how? depends on your database structure.

You should start with simple php/mysql tutorials (google is full of them)

vbignacio
Thu 15 November 2007, 10:52 am GMT +0100
i dont use mysql.

olaf
Thu 15 November 2007, 11:10 am GMT +0100
i dont use mysql.
how are the listings stored? text files?

vbignacio
Thu 15 November 2007, 11:27 am GMT +0100
just .php files

olaf
Thu 15 November 2007, 11:35 am GMT +0100
just .php files
but what do you want sort the date of this files?

vbignacio
Thu 15 November 2007, 11:41 am GMT +0100
yeah. i wish i could show a link to the newest file in each directory in my homepage. like a list of ten newest articles.

olaf
Thu 15 November 2007, 11:46 am GMT +0100
yeah. i wish i could show a link to the newest file in each directory in my homepage. like a list of ten newest articles.

you need to play with the directory class, this snippet is just an example how to do that:
http://www.finalwebsites.com/snippets.php?id=26

vbignacio
Thu 15 November 2007, 11:58 am GMT +0100
thanks for your time olaf.

vbignacio
Thu 15 November 2007, 03:07 pm GMT +0100
this is what i need, but instead of the oldest file, which line do i have to change so it would get the newest file? thanks!

olaf
Thu 15 November 2007, 03:10 pm GMT +0100
this is what i need, but instead of the oldest file, which line do i have to change so it would get the newest file? thanks!

check this function http://nl2.php.net/manual/en/function.rsort.php

vbignacio
Thu 15 November 2007, 03:22 pm GMT +0100
based on the examples, does this mean that the asort function sorts an array from oldest to newest and rsort does it in reverse?

olaf
Thu 15 November 2007, 03:39 pm GMT +0100
based on the examples, does this mean that the asort function sorts an array from oldest to newest and rsort does it in reverse?
yep

vbignacio
Thu 15 November 2007, 11:52 pm GMT +0100
thanks. that does it for me. what if there are multiple files that have the same time stamp? how would the script decide which file to choose? would it do it alphabetically?

olaf
Thu 15 November 2007, 11:54 pm GMT +0100
thanks. that does it for me. what if there are multiple files that have the same time stamp? how would the script decide which file to choose? would it do it alphabetically?
from the same second? do you checked the manual for this info?

vbignacio
Fri 16 November 2007, 01:43 am GMT +0100
yes, my articles are generated in batches of ten at a time so i guess they have the same time stamp up to the last second. it doesnt say in the manual. i think i will make a test page to find out.

thanks for pointing me to the right direction. i dont know what to look for to begin with.

YMC
Fri 16 November 2007, 05:33 pm GMT +0100
Keep in mind I don't know anything on php programming, but couldn't you use an RSS feed of some sort - it would seem that would ensure the last listing would be used from each directory?

Mind_nl
Fri 16 November 2007, 06:09 pm GMT +0100
That would require writing a script, much like the one used, to create the RSS feed first. The site is just a collection of separately stored pages without the use of some CMS that has RSS feeds integrated.

vbignacio
Sat 17 November 2007, 12:01 am GMT +0100
... couldn't you use an RSS feed of some sort...

thanks for your suggestion, ma'am, but Nico is right. my article site is not on cms. actually its a "frankenstien" site of pieced together-scripts.

Archive for SMF v1.00 by N.P. Valid XHTML 1.0 Transitional