Show
Ignore:
Timestamp:
08/26/2007 01:44:14 PM (16 months ago)
Author:
Shadowhand
Message:

Fixing View to allow $this to be used in views (and refer to the controller), and enabling view-in-view loading to work. Also updated the Welcome controller to demonstrate how it's done.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/devel/application/controllers/welcome.php

    r405 r409  
    11<?php 
    22 
    3 class Welcome extends Controller { 
     3class Welcome_Controller extends Controller { 
    44 
    55        function index() 
    66        { 
    7                 $this->load->view('welcome')->set('message', 'testing')->render(TRUE); 
    8                 print "hi"; 
     7                print new View('welcome', array('message' => 'testing calls back to the controller')); 
     8                 
     9                // $db = new Database(); 
     10                // print_r ($db); 
    911        } 
    1012 
    11         function _index() 
     13        function say_hello() 
    1214        { 
    13                 $this->load->helper('url'); 
    14                 print "<p>Welcome to ".url::site('welcome')."!</p>\n"; 
    15                  
    16                 $this->load->model('users'); 
    17                 print "<p>Model test: ".$this->users->hi()."!</p>\n"; 
    18  
    19                 print "<p>Rendered in {execution_time} seconds</p>\n"; 
     15                return '<strong>OMG HI!!!!1</strong>'; 
    2016        } 
    2117 
    2218} 
    23  
    24 ?>