Changeset 3275 for trunk/application
- Timestamp:
- 08/06/2008 08:31:35 AM (4 months ago)
- Files:
-
- 1 modified
-
trunk/application/controllers/welcome.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/application/controllers/welcome.php
r2622 r3275 9 9 * @license http://kohanaphp.com/license.html 10 10 */ 11 class Welcome_Controller extends Controller {11 class Welcome_Controller extends Template_Controller { 12 12 13 13 // Disable this controller when Kohana is set to production mode. … … 15 15 const ALLOW_PRODUCTION = FALSE; 16 16 17 // Set the name of the template to use 18 public $template = 'kohana/template'; 19 17 20 public function index() 18 21 { 19 22 // In Kohana, all views are loaded and treated as objects. 20 $ welcome= new View('welcome');23 $this->template->content = new View('welcome'); 21 24 22 25 // You can assign anything variable to a view by using standard OOP 23 26 // methods. In my welcome view, the $title variable will be assigned 24 27 // the value I give it here. 25 $ welcome->title = 'Welcome to Kohana!';28 $this->template->title = 'Welcome to Kohana!'; 26 29 27 30 // An array of links to display. Assiging variables to views is completely 28 31 // asyncronous. Variables can be set in any order, and can be any type 29 32 // of data, including objects. 30 $ welcome->links = array33 $this->template->content->links = array 31 34 ( 32 35 'Home Page' => 'http://kohanaphp.com/', … … 36 39 'Donate' => 'http://kohanaphp.com/donate.html', 37 40 ); 38 39 // Using views inside of views is completely transparent. In the welcome40 // view, printing the $content variable will render the welcome_content view.41 $welcome->content = new View('welcome_content');42 43 // Using render(TRUE) forces the view to display now, instead of44 // returning an HTML string.45 $welcome->render(TRUE);46 41 } 47 42 48 43 public function _default() 49 44 { 45 // Disable auto-rendering 46 $this->auto_render = FALSE; 47 50 48 // By defining a method called _default, all pages routed to this controller 51 49 // that result in 404 errors will be handled by this method, instead of … … 54 52 } 55 53 56 } 54 } // End Welcome Controller
