I want to convert an existing ColdFusion Fusebox 3 design to PHP. (Not Fusebox 4 because I've seen reports of problems running that on shared hosting)

So I set up PHP FB 3 in the root directory of a new virtual host on my development kit.

Then as a starter I tried a cut-down version of a standard forms processing structure:

  1. A fuse shows a form.
  2. Another fuse processes the form
  3. If it finds validation errors, it invokes the first fuse to re-display the form after setting other attributes to supply error messages.

Except that to keep things really simple:

* The form page just has a message, not an HTML form.
* The action page just asks FB3 to show the "form".
* I skipped step (1) and just asked the browser to process the "form" -

webroot/index.php?fuseaction=app_A.process

And I got:

* confirmation that the 'process' page had worked (I'd inserted an echo).
* PHP error message:
  Warning: Failed opening '[I]webroot[/I]\app_A/app_A/fbx_Switch.php' for inclusion (include_path='.;c:\php4\pear') in [I]webroot[/I]\fbx_Fusebox3.0_PHP4.1.x.php on line 256

This was when FB 3 attempted to process the "action" page's request to show the "form".

So what am I doing wrong? The equivalent code works fine in ColdFusion with FB 3. Which part of my mind do I need to adjust? (No facetious answers, please)

Here's all of the code, except the fusedoc comments, the PHP tags and the fbx_Layouts.php files (the layout variables are all empty strings):

fbx_Circuits.php
$Fusebox["circuits"]["home"] = "home";
$Fusebox["circuits"]["app_A"] = "home/app_A";

fbx_Settings.php - top level - all I've changed is the default fuseaction.
//In case no fuseaction was given, I'll set up one to use by default.
if(!isset($attributes["fuseaction"])){
$attributes["fuseaction"] = "app_A."; // The switch sets default Fusebox['fuseaction']
}

//useful constants
if(!isset($GLOBALS["self"])){ $GLOBALS["self"] = "index.php"; }
$XFA = array();

//default values for layout files
$Fusebox["layoutDir"] = "";
$Fusebox["layoutFile"] = "";

//should fusebox silently suppress its own error messages? default is FALSE
$Fusebox["suppressErrors"] = false;

if($Fusebox["isHomeCircuit"]) {
session_start(); )
} else {
}

fbx_Settings.php - directory app_A
//default values for layout files
$Fusebox["layoutDir"] = "";
$Fusebox["layoutFile"] = "";
//should fusebox silently suppress its own error messages? default is FALSE
$Fusebox["suppressErrors"] = false;
if($Fusebox["isHomeCircuit"]) {
//put settings here that you want to execute only when this is the application's home circuit (for example: session_start(); )
} else {
//put settings here that you want to execute only when this is not an application's home circuit
}
//Put settings out here that should run regardless of whether this is the home app or not

fbx_Switch.php - directory: app_A - circuit: app_A
switch($Fusebox["fuseaction"]) {
case "show":
include("show_dsp.php");
break;

default:
$Fusebox['fuseaction'] = 'process';
include("process_act.php");
/
print "I received a fuseaction called <b>'" . $Fusebox["fuseaction"] . "'</b> that circuit <b>'" . $Fusebox["circuit"] . "'</b> does not have a handler for.";
break;
/
}

app_A/process_act.php
echo '<p><b>process_act</b>
invoking display page</p>';
$attributes['fuseaction'] = "app_A.show";
include($Fusebox["rootPath"] . $GLOBALS["self"]);

app_A/show_dsp.php
echo '<p><b>show_dsp.php</b></p>';

    Write a Reply...