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 
iPad news and developer info.
Ads by affinity 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
VPS Hosting 
Forums Sitemap 
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


    Summary: 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 a Recursive Loading Class for Loader Applications in PHP
    (Page 1 of 4 )

    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

    - PHP Excel Customizations: Working with Formu...
    - MVC and the Zend Framework
    - PHP: Rendering Web Pages Using the Composite...
    - PHP: Creating Dynamic Web Pages with the Com...
    - Secure Encrypting and Decrypting for Your PH...
    - PHP: Creating Single View Objects with the C...
    - PHP: View Object Collections and the Composi...
    - Securing Your PHP Website
    - Determine Link Relevance and Unique Class C ...
    - PHP Composite View Design Pattern: Introduci...
    - Facebook PHP API Applications: A Second Look
    - Secure PHP Programming
    - Facebook PHP API Applications: Basic Introdu...
    - SOAP Servers and Web Services
    - Using XPath, SOAP, and More with Web Services


    Code Analysis Tools
    Enterprise code analysis tools that deliver quality and reliable code



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