Phrame 3 Documentation Home  |  Features  |  Downloads  |  Contact Documentation > How To Trigger The Phrame Container
How To...
Install Phrame 3
Configure The Phrame Container
Configure An Action Server
Configure The Error Handler
Define A Module Configuration
Trigger An Action Server
Trigger An Action
Use Language Negotiation
Use Session Validation
Use Phrame Tag Libraries
Load Classes Just In Time
 
How To Trigger The Phrame Container
From Phrame version 3.1 and onwards Phrame action servers run in the so-called Phrame container. A single container may support multiple action servers.

The PhrameContainer class mimicks some of the functionality of a Java web container, which in pre 3.1 versions used to be part of the ActionServer class.

Triggering the container
To run a Phrame application, you have to create and configure a PhrameContainer instance and call its run() method to select an activate the appropriate action server. It makes sense to create a dedicated PHP ' action server' script for this purpose.

If your application uses only one front-end controller, you will obviously have one action server script. In this case your container configuration will only contain one action server configuration for the so-called default action server. See How To Configure The Phrame Container for details.

If your application uses more front-end controllers, you will have multiple action server scripts, one for each action server. As a consequence, users will have multiple entry points to the application, much similar to the Java servlet principle. In this case your container configuration will also contain multiple action server configurations, one of which might represent the default action server.

From Phrame version 3.1 onwards you basically have two mechanisms to partition your application: Which mechanism to implement depends on the complexity and size of your application. Perhaps you are developing an application suite with multiple applications, in which case it could be feasible to have multiple action servers, one for each application front-end.

If you are developing a single application with a single front-end, it does not make a lot of sense to have multiple action servers controling it. You might however still need modules to split up your application in smaller parts.

Tasks of an action server script
As a minimum, an action server script has to perform the following tasks:

  1. Include Phrame's core classes;
  2. Include or define the array holding the configuration parameters for the Phrame container;
  3. Construct a PhrameContainer instance;
  4. Call the run() method of the PhrameContainer activating the appropriate action server.
Note that an action server script normally does not refer to an action. To force Phrame to show the first web page of your application, you have to either define a welcome file in the container configuration (see the example below) or define a default action in the module configuration for the default application module (see How To Define A Module Configuration on how to do this).

You could also define a named application module in your action server script to force Phrame to load a specific module configuration with a matching default action (see How To Trigger An Action on how to do this).

Example
The following code snippet gives an example of an action server script running the default action server (could be the only one in your application).
//Include Phrame's core library
include('/WEB-INF/lib/phrame/include.php');

// Include array holding the container configuration
include('/WEB-INF/conf/container-config.php');

// Construct a PhrameContainer instance (assuming the
// container configuration is in an array variable 
// called $config). Note that the & is not needed
// (strictly speaking not even allowed) in PHP5.
$container =& new PhrameContainer($config); 

// Run the default action server
$container->run();

In case your application consists of more action servers, you have to pass the name of the appropriate server to the run() method, like so:

// Run the action server called '2ndFrontEnd'
$container->run('2ndFrontEnd');
© 2005 Pieter A. van Stempvoort. All rights reserved.
Hosted by www.Geocities.ws

1