PHP
  Home arrow PHP arrow Page 8 - Scratching the Surface: Getting Starte...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
Moblin 
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: 4 stars4 stars4 stars4 stars4 stars / 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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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

    Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!

    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

    - Handling Attachments in MIME Email with PHP
    - Completing the Project Management Application
    - Sending MIME Email with PHP
    - Handling Files for a Project Management Appl...
    - Viewing and Editing Tasks for a Project Mana...
    - More on Private Methods with PHP 5 Member Vi...
    - Adding Tasks to a Project Management Applica...
    - Utilizing Private Methods with PHP 5 and Mem...
    - Making Changes in a Project Management Appli...
    - Defining Public and Protected Methods with M...
    - HTML for a Project Management Application
    - Using Subclasses and Accessors with Member V...
    - Implementing Internet Protocols with PHP
    - Project Management: The Application
    - Working with Private Properties to Protect P...




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway