Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Fusebox 3: 'failed opening ..fbx_Switch.php'

Status
Not open for further replies.

philcha

Programmer
May 10, 2000
109
GB
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 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:
[ol]
[li]A fuse shows a form.[/li]
[li]Another fuse processes the form[/li]
[li]If it finds validation errors, it invokes the first fuse to re-display the form after setting other attributes to supply error messages.[/li]
[/ol]

Except that to keep things really simple:
[ul]
[li]The form page just has a message, not an HTML form.[/li]
[li]The action page just asks FB3 to show the "form".[/li]
[li]I skipped step (1) and just asked the browser to process the "form" -
webroot/index.php?fuseaction=app_A.process[/li]
[/ul]

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

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>';
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top