Re: Order directory output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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           |
:------------------------------------------------------------:

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux