Phrame 3 Documentation Home  |  Features  |  Downloads  |  Contact Documentation > How To Trigger An Action
How To...
Install Phrame 3
Configure The Phrame Container
Configure An Action Server
Configure The Error Handler
Define A Module Configuration
Trigger The Phrame Container
Trigger An Action Server
Use Language Negotiation
Use Session Validation
Use Phrame Tag Libraries
Load Classes Just In Time
 
How To Trigger An Action
To trigger an action, you have to include a module and an action parameter in your request. You may omit the module parameter if your application only uses one module configuration or if you want to use the configuration for the default application module.

The way to include the parameters depends on the method you use to submit a request. Note that in the examples below the names of the parameters are specified directly, which in reality will not work. See the paragraphs on 'How to specify the module and action parameter name' below how to include the parameter names in your request.

GET method
If you are submitting a form, include the parameters in the URL that you specify in the action attribute of the <form> element. For example:

<form method="GET" 
      action="myApp/index.php?module=myModule&
                              action=doThis">

  ...
  your form fields here
  ...

</form>

If you are calling the bootstrap script from a link, include the parameters in the URL that you specify in the href attribute of the <a> element. For example:

<a href="myApp/index.php?module=myModule&
                         action=doThis"/>

POST method
Include the parameters as hidden variables in the form you are posting to bootstrap script. For example:

<form method="POST" action="myApp/index.php">

  <input type="hidden" name="module" value="myModule"/>
  <input type="hidden" name="action" value="doThis"/>

  ...
  your other form fields here
  ...

</form>

How to specify the module and action parameter name (pre 3.1 versions)
You have to use the predefined constants _MODULE and _ACTION to include the module and action parameter names in your request, rather than using the string "module" or "action". If you forget to do this, unexpected errors may occur.

The PHP code for this could be something like <?php echo _MODULE ?> and <?php echo _ACTION ?>

In many cases it is also a good idea to use the predefined PHP variable $_SERVER['PHP_SELF'] to identify the bootstrap script.

How to specify the module and action parameter name (version 3.1 and later)
You may specify the names of the module and action parameter in the configuration of each action server that will be running in the Phrame container. The code snippet below shows an example. If you donot specify the parameter names, Phrame will use module and action (as with pre 3.1 versions).

$containerConfig = array(

  // Action server configurations
  _SERVERS => array(

    // Configuration of the (default) action server
    '' => array(

      // The server's module & action mapping
      _SERVER_MAPPING => array(
        _MODULE_PARAM  => 'theModule'
        ,_ACTION_PARAM => 'theAction'
      )

      // The server's initialization parameters
      ,_INIT_PARAMS => array(
        _CONFIGS => array(
          ''       => '/WEB-INF/conf/default-conf.xml'
          ,'addon' => '/WEB-INF/conf/addon-conf.xml'
        )
        ,_DIGESTER_CLASS => 'util/xmlConfigDigester'
      )
  )

  ...
  other container configuration parameters go here
  ...

);

In this case Phrame will determine the module and action from request parameters theModule and theAction. Note that you still have to use the predefined _MODULE and _ACTION constants to include the names in the request (see before).

© 2005 Pieter A. van Stempvoort. All rights reserved.
Hosted by www.Geocities.ws

1