pyrosarco Posted February 28, 2008 Share Posted February 28, 2008 I basically want to make a very simple blog. I will have a folder for the year called '2008.' In the folder, I will have text files listed in date order, with the newest being the highest number. So the names of the text files will appear as 20080214.txt 20080213.txt 20080209.txt for February 14th, 13th and 9th and so on. How do I find the last ten largest numbers and return them to be printed in a .php for the web? I'm thinking the name has to be stored in a string and then appended to something that prints <?php include('folder/filename') ?> Thanks, pyrosarco Quote Link to comment Share on other sites More sharing options...
pyrosarco Posted February 28, 2008 Author Share Posted February 28, 2008 This should probably be moved to the Freelance board that I have now noticed... Quote Link to comment Share on other sites More sharing options...
keeB Posted February 28, 2008 Share Posted February 28, 2008 is there a reason you don't want to use a database for your blog? It doesn't make much sense that you wouldn't. I know it's daunting at first, but I promise, it's really easy! Here's a way to get the past 10 days, though <?php #print date("Y-m-d", strtotime("yesterday")); for ($i=0; $i<10; $i++) { print date("Y-m-d", strtotime("$i days ago")) . "<br>"; } ?> Using that method it could be simply modified to do the following: <?php #print date("Y-m-d", strtotime("yesterday")); for ($i=0; $i<10; $i++) { $year = date("Y", strtotime("$i days ago")) . "<br>"; $month = date("m", strtotime("$i days ago")) . "<br>"; $day = date("d", strtotime("$i days ago")) . "<br>"; print returnPost($year, $month, $day); } function returnPost($year, $month, $day) { #read file, etc } Quote Link to comment Share on other sites More sharing options...
unsider Posted February 28, 2008 Share Posted February 28, 2008 Google search some tutorials on file input/output? I'm not clear on your question. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.