Jump to content


Photo

List # last edited?


  • Please log in to reply
5 replies to this topic

#1 no404

no404
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 15 May 2006 - 01:07 AM

Is it possible to include the (let's say) 30 last edited files? And how? I tried the libraries. but couldn't find anything=/ And btw, what's the difference between "include" and "require"?

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 15 May 2006 - 02:09 AM

well if you have a time/date type column and have it autoupdate every time a row is updated, you can always do like

select * from table order by timecolumn desc limit 30

require vs. include:

from the manual:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Unlike include(), require() will always read in the target file, even if the line it's on never executes. If you want to conditionally include a file, use include(). The conditional statement won't affect the require(). However, if the line on which the require() occurs is not executed, neither will any of the code in the target file be executed.
[/quote]
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 no404

no404
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 15 May 2006 - 02:24 AM

Uh, sorry, but I didn't quite understandish that column/row thing. But i got the include vs request, thx:)

#4 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 15 May 2006 - 03:13 AM

oh wait, you mean like files. for some reason i saw rows (as in, database table rows) instead of files. silly me.

use scandir to retrieve an array of the files, then loop through each array element with a foreach or a while loop and use filemtime to get the time modified. Also, inside the loop, make an array of the times, and then sort the array with rsort to sort them greatest (most recent) to least (oldest) and finally, do a for loop that counts to 30, echoing the values, or whatever you want to do with them.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#5 no404

no404
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 15 May 2006 - 03:39 AM

Think i got that one;) Will it be easier to sort them after filename, and show the 30 first?

#6 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 15 May 2006 - 10:19 PM

yes. you are going to have to retrieve the last modified dates with filemtime before you can figure out which ones were modified the soonest.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users