PHP Classes

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

Recommend this page to a friend!
  Packages of Haseeb Ahmad Basil   PHP Skeleton Framework   examples/view/app/controllers/example.php   Download  
File: examples/view/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: 10 years ago
Size: 1,574 bytes
 

Contents

Class file image Download
<?php

class example extends A_Controller_Action {

    function index($locator) {
        $view = $this->_load()->view();
        $view->set('title', 'This is the title set in the controller');    
        $view->set('colors', array(
                                array('id'=>'1', 'color'=>'Red'), 
                                array('id'=>'2', 'color'=>'Blue'), 
                                array('id'=>'3', 'color'=>'Green'), 
                                ));    
        echo $view->render();
    }
    
    function simpletemplate($locator) {
        $view = $this->_load()->view();
        $view->set('title', 'This is the title set in the controller');    
        echo $view->render();
    }
    
    function needsdifferenttemplate($locator) {
        $view = $this->_load()->view();
        $view->set('title', 'This is the needsdifferenttemplate title set in the controller');    
        $view->set('content', 'This is the content set in the action needsdifferenttemplate');
        $view->setTemplate('differenttemplate');
        
        echo $view->render();
    }
    
    function actionsetscontent($locator) {
        $view = $this->_load()->view();
        //$view = new A_Http_View();
        $view->setTemplate('');
        $view->setContent('<p>This is the content set in the action actionsetscontent</p><p>Click the back button to return to the example.</p>');
        echo $view->render();    
    }
    
    function actionsetsrenderer($locator) {
        //$view = $this->_load()->view();
        
        $template = $this->_load()->template('setsrenderertemplate.html');
        $template->set('content', 'This is content set in the the action actionsetsrenderer.');
        
        $view = new A_Http_View();
        $view->setRenderer($template);    
        echo $view->render();    
    }    

}