Re: Order directory output

From: Date: Sat, 09 Feb 2008 04:29:24 +0000
Subject: Re: Order directory output
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-269000@lists.php.net to get a copy of this message
On Fri, 2008-02-08 at 21:19 -0500, Nathan Nobbe wrote: > i hooked up an spl example; and the files are sorted by name. > also, did you want that <p> inside or outside the <span> w/ > class=NormalText, because the opening and closing tags are > mixed up.. > Here is another, generic extension filter with SPL. Untested, and I have just woken up, so if it doesn't work... :-P class ExtensionFilter extends FilterIterator { private $ext; private $it; public function __construct(DirectoryIterator $it, $ext) { parent::__construct($it); $this->it = $it; $this->ext = $ext; } public function accept() { if ( ! $this->it->isDir() ) { $ext = array_pop(explode('.', $this->current())); return $ext != $this->ext; } return true; } } --Paul -- ------------------------------------------------------------. | Chisimba PHP5 Framework - http://avoir.uwc.ac.za | :------------------------------------------------------------:

« previous php.general (#269000) next »