waViewController

Processing of HTTP requests and returning of HTML string generated mainly by means of layout and action classes

Contents...

Parent class: waController.

See explanation of HTTP request routing in backend and in frontend.

The main difference of this controller to its parent class is in its capability to use page layouts, execute arbitrary actions for generating main page content, and return generated HTML content to user.

Main HTTP request processing logic must be described in public method execute().

Methods

  • executeAction

    Executes method display() of specified action class for returning generated HTML string as response to user's request.

  • getLayout

    Returns instance of waLayout class currently used for creating the general page layout.

  • setLayout

    Sets current layout (waLayout) for creating general page layout.

public function executeAction (waViewAction $action, $name = 'content', waDecorator $decorator = null)

Executes method display() of specified action class for returning generated HTML string as response to user's request.

Parameters

  • $action

    Instance of waViewAction class.

  • $name

    Name of block to which the result of specified action's display() method must be assigned. By default, block name 'content' is used.

  • $decorator

    Optional instance of waDecorator class to whose display() method a PHP action class instance must be passed as a parameter instead of calling that action's display() method. By default, no decorator is used.

Example

$this->executeAction(new myappBackendNewPageAction());

public function getLayout ()

Returns instance of waLayout class currently used for creating the general page layout.

Example

$current_layout = $this->getLayout();

public function setLayout (waLayout $layout=null)

Sets current layout (waLayout) for creating general page layout.

Parameters

  • $layout

    Instance of waLayout class, which must be used to generate the layout of the action page.

Example

$this->setLayout(new myappBackendLayout());