Re: A primary practicall for the pros- the easiest way to sort files in a directory by name or date.?

From: Date: Sun, 16 Dec 2001 00:42:05 +0000
Subject: Re: A primary practicall for the pros- the easiest way to sort files in a directory by name or date.?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-77838@lists.php.net to get a copy of this message
depends on how elegant you want: passthru("ls -l | awk '{print $9}' "); //sort by name ascending passthru("ls -lt | awk '{print $9}' "); //sort by modification time descending add -r to the ls command to reverse the order of either sort instead of using passthru, you could use exec and pipe the information to arrays. ----- Original Message ----- From: "php" <php@nm.ru> To: <php-general@lists.php.net> Sent: Saturday, December 15, 2001 5:24 PM Subject: [PHP] A primary practicall for the pros- the easiest way to sort files in a directory by name or date.? > Hello friends, > Here's the question that's bugging me, explanations are under the > --------- line. > > How do you > 1)Sort files in a directory by date and print/echo into an html format > (and the latest article is.....) > 2)Fastest way to list files by "<title>Page name</title>" > > ---------------------- > Say you have a directory that you want to sort by date/size/whatever/ > What do you think would be the best way to do it? > arrays? > MYSQL/or other DB? > string comparison? > other ideas? > ---------- > > My sysadmin insists on database implementation- however, i have a > variety of clients that are scared of databases , or are simply > content with the provider they have, that doesn't offer DB (yes, there > are those still!) > What do you think would be the fastest and easiest way to > This is close to the famous "resource grabber" script, but not quite- > we are talking about the basic principles of {parsing a document for > certain info and echo/printing it out into html. > To keep the long question short- > ------------------------- > I, must confess that i have little experience with PHP-programming- > the wonderful implementation of php-MySQL and ZEND makes it too easy > for me to put everything into a database and forget the whole thing. > > ------------------------ > I believe that this matter is paramount because what we're dealing > with is the most fundamental and practicall execution of a "site > engine"/ "content management system"- i.e . the best and fastest code > for sorting a directory by "<title>sort by html name </title>" > or "sort by date" > It is easily executed by XML or (RDF, etc)but, the question remains > -what do you think is the best way to execute the sorting by PHP's > sorting abilities? > As far as i know, there is no title sorting in php, as opposed to > perl/ > Am i wrong? > > > > > -- > Best regards, > php mailto:php@nm.ru > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#77838) next »