PHP Classes

File: examples/actioncontroller/app/controllers/example.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil   PHP Skeleton Framework   examples/actioncontroller/app/controllers/example.php   Download  
File: examples/actioncontroller/app/controllers/example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Skeleton Framework
Extensive Web application development framework
Author: By
Last change:
Date: 8 years ago
Size: 1,860 bytes
 

Contents

Class file image Download
<?php

class example extends A_Controller_Action {

    function
index($locator) {
       
$content = '
<html>
<body>
    <h2>Front Controller: Page - Base Action Controller</h2>
    <ol>
        <li><a href="?controller=example">Default controller, no specified.</a></li>
        <li><a href="?controller=example&action=foo">Default controller, specific - foo.</a></li>
        <li><a href="?controller=example&action=bar">Default controller, specific - bar.</a></li>
        <li><a href="?controller=dispatch">Dispatch Action controller, no specified.</a></li>
        <li><a href="?controller=dispatch&action=foo">Dispatch Action controller, specific - foo.</a></li>
        <li><a href="?controller=dispatch&action=bar">Dispatch Action controller, specific - bar.</a></li>
        <li><a href="?module=module1&controller=example">Module and controller, no specified.</a></li>
        <li><a href="?module=module1&controller=example&action=bar">Module and controller, specific specified.</a></li>
    </ol>
    <br/>
    <p><a href="../">Return to Examples</a></p>
'
;
       
$model = $this->_load()->model();
       
$content .= '<br/>Model Object:<pre>' . print_r($model, 1) . '</pre>';

       
$months = $this->_load()->model('MonthsModel');
       
$content .= '<br/>Model Months Object:<pre>' . print_r($months, 1) . '</pre>';

       
$content .= '<br/>Action Object:<pre>' . print_r($this, 1) . '</pre>';
       
$content .= '
</body>
</html>
'
;
       
$this->response->setContent($content);
    }

    function
foo($locator) {
       
$this->_flash()->set('foo', 'This is a flash var.');
       
$this->_load()->response()->template('', array('foo'=>'Set flash var.'));
    }

    function
bar($locator) {
       
$this->_load()->helper('foo');
       
$bar = $this->_helper('foo')->bar('This is the arg for bar helper. ');
       
$value = $this->_flash()->get('foo');
       
$this->_load()->response()->template('', array('foo'=>$value, 'bar'=>$bar));
    }

}