PHP
  Home arrow PHP arrow Page 8 - Scratching the Surface: Getting Started with PHP Fusebox
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? 
PHP

Scratching the Surface: Getting Started with PHP Fusebox
By: Mike Britton
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 8
    2002-05-29


    Table of Contents:
  • Scratching the Surface: Getting Started with PHP Fusebox
  • Step 1: Setting Up the Core Files
  • What do the "core files" do?
  • A Word on FuseDocs
  • Fusebox Naming Conventions
  • Picking Up Where We Left Off: Setting Up the Core Files
  • Using XFAs
  • Step 2: Creating the "Biography" Circuit
  • Almost There!
  • PHP-Fusebox Links
  • Fusebox Links

  • 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


    Scratching the Surface: Getting Started with PHP Fusebox - Step 2: Creating the "Biography" Circuit
    ( Page 8 of 11 )

    You've added code that references the biography circuit, so now it's time to create it!  In your application root (the one you're calling "home" in fbx_Circuits.php), create another directory and call it bio.  This is where we're going to build the biography circuit.

    Now you must copy the following PHP Fusebox core files into the bio directory (it's a subset of the same files found in your application root):

    DefaultLayout.php

    dsp_main.php

    fbx_SaveContent.php

    fbx_Settings.php

    fbx_Switch.php

    index.php

    See, there's fbx_Switch.php again!  The biography circuit's fbx_Switch.php will include the files needed to satisfy the fuseactions passed to it, as we've already discussed.

    Open the /bio directory's fbx_Switch.php.

    You will see similar code to the fbx_Switch.php we already edited, in the application root:

    switch($Fusebox["fuseaction"]) {

          case "main":

          case "Fusebox.defaultFuseaction":

                include("dsp_main.php");

                break;

          default:

                print "I received a fuseaction called <b>'" . $Fusebox["fuseaction"] . "'</b> that circuit <b>'" . $Fusebox["circuit"] . "'</b> does not have a handler for.";

                break;

    }

    Keep this file open, and focus back on fbx_Switch.php in the application root.  Remember when we created an XFA for the "biography" circuit?

    switch($Fusebox["fuseaction"]) {

          case "main":

          case "Fusebox.defaultFuseaction":

    // Add this line:

    $XFA["biography"] = "biography.hello_world";

                include("dsp_main.php");

                break;

          default:

                print "I received a fuseaction called <b>'" . $Fusebox["fuseaction"] . "'</b> that circuit <b>'" . $Fusebox["circuit"] . "'</b> does not have a handler for.";

                break;

    }

    Now we're going to adjust the fbx_Switch.php file in /bio to accommodate the XFA we just set up in the application root's fbx_Switch.php.  Add the code in bold to the /bio directory's fbx_Switch.php:

    switch($Fusebox["fuseaction"]) {

          case "main":

          case "Fusebox.defaultFuseaction":

                include("dsp_main.php");

                break;

          case "hello_world":

                include("dsp_hello_world.php");

                break;

          default:

                print "I received a fuseaction called <b>'" . $Fusebox["fuseaction"] . "'</b> that circuit <b>'" . $Fusebox["circuit"] . "'</b> does not have a handler for.";

                break;

    }

    Now open dsp_main.php in /bio and save it back down as dsp_hello_world.php. Add the following code to dsp_hello_world.php:

    <h3>Biography: Hello World!</h3>

    This is the place where the world can come learn about me.

    <p>

    <?

    echo "<a href=\"$PHP_SELF?fuseaction=".$XFA["home"]."\">Home</a>";

    ?>



     
     
    >>> More PHP Articles          >>> More By Mike Britton
     

       

    PHP ARTICLES

    - Using Directory Iterators to Build Loader Ap...
    - Using the spl_autoload() Functions to Build ...
    - Working Out of the Object Context to Build L...
    - Using the _autoload() Magic Function to Buil...
    - The Destruct Magic Function in PHP 5
    - The Autoload Magic Function in PHP 5
    - Developing a Recursive Loading Class for Loa...
    - The Sleep and Wakeup Magic Functions in PHP 5
    - Using the Clone Magic Function in PHP 5
    - Including Files Recursively with Loader Appl...
    - The Call Magic Function in PHP 5
    - Designing a Captcha System with PHP and MySQL
    - Using Static Methods to Build Loader Apps in...
    - The Isset and Unset Magic Functions in PHP 5
    - Advanced PHP Form Input Validation to Check ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT