PHP
  Home arrow PHP arrow Developing a Recursive Loading Class for Loader Applications in PHP
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Developing a Recursive Loading Class for Loader Applications in PHP
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 4
    2009-06-18


    Table of Contents:
  • Developing a Recursive Loading Class for Loader Applications in PHP
  • Review: building a basic file loading class with PHP 5
  • Defining a class with recursive file searching capabilities
  • Defining the recursive load() method

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Developing a Recursive Loading Class for Loader Applications in PHP
    ( Page 1 of 4 )

    Welcome to the third part of an eight-part series on building loader applications in PHP. In the tutorials that comprise this series you’ll find numerous examples aimed at demonstrating how to create small, yet efficient, resource loader classes, not only by taking advantage of PHP includes, but the handy “__autoload()” magic function and the Standard PHP Library (SPL) as well.

    Developing PHP programs whose main task is to dynamically include files required by a specific application isn’t as difficult as it may seem at first sight. In these cases, the logic that drives those programs is implemented around the set of “include()/include_once()/require()/require_once()” native PHP functions, which are pretty familiar to many developers having an average background on this language.

    So, if you’re searching for an approachable guide that shows you how to build file loading applications in PHP 5, without having to pull your hair desperately, then hopefully this group of articles will give you the material you're looking for.  

    By this time, you’re well aware of the goal of this article series, so I’d like to spend a few moments refreshing the concepts I explained in the previous part. In that article, I developed a basic loader class which was capable of including a specified file without having to create any instances of the class. This capacity was implemented by defining a static loading method, which was in reality the class’s workhorse, since it acted like a wrapper for the “require_once()” PHP function. 

    While this file loading class in its current incarnation does a pretty good job, it lacks an important feature that could be added with relative ease. It cannot perform a recursive search through the web server’s file system, and afterward include a specified file within a given application. 

    Essentially, the class would be passed a starting path to look for, and from that point onward it would recursively traverse the subfolders, until finding the targeted file. That’s an ability found in many popular PHP applications available nowadays, and in the next few lines I’m going to explain how to implement it, based mostly on the structure of the loader class created in previous chapter of the series. 

    Now, let’s start learning how to build a loading class that will have recursive file searching capabilities. Let’s get going!



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek