Changeset 2128
- Timestamp:
- 02/21/2008 08:56:41 PM (11 months ago)
- Location:
- releases/2.1.2
- Files:
-
- 3 modified
- 3 copied
-
Kohana License.html (copied) (copied from trunk/Kohana License.html)
-
application/controllers/examples.php (modified) (4 diffs)
-
application/controllers/welcome.php (modified) (2 diffs)
-
application/views/welcome.php (modified) (1 diff)
-
application/views/welcome_content.php (copied) (copied from trunk/application/views/welcome_content.php)
-
kohana.png (copied) (copied from trunk/kohana.png)
Legend:
- Unmodified
- Added
- Removed
-
releases/2.1.2/application/controllers/examples.php
r1911 r2128 25 25 ); 26 26 27 sort($examples); 28 27 29 echo "<strong>Examples:</strong>\n"; 28 30 echo "<ul>\n"; … … 48 50 49 51 // Add welcome.php with the name of test.php 50 $archive->add(APPPATH.' controllers/welcome.php', 'test.php');52 $archive->add(APPPATH.'views/', 'shitty/views', TRUE); 51 53 52 54 // Download the built archive … … 55 57 else 56 58 { 57 echo html::anchor(Router::$current_uri.'/build', 'Download welcome.php as test.php');59 echo html::anchor(Router::$current_uri.'/build', 'Download views'); 58 60 } 59 61 } … … 96 98 function session() 97 99 { 98 $this->load->database();99 100 $s = new Session(); 100 101 -
releases/2.1.2/application/controllers/welcome.php
r1522 r2128 1 1 <?php defined('SYSPATH') or die('No direct script access.'); 2 2 /** 3 * @package Core 4 * 3 5 * Default Kohana controller. 4 6 */ … … 7 9 public function index() 8 10 { 11 // In Kohana, all views are loaded and treated as objects. 9 12 $welcome = new View('welcome'); 10 $welcome->message = 'This is the default Kohana index page. You can edit <tt>application/controllers/welcome.php</tt> now.'; 13 14 // You can assign anything variable to a view by using standard OOP 15 // methods. In my welcome view, the $title variable will be assigned 16 // the value I give it here. 17 $welcome->title = 'Welcome to Kohana!'; 18 19 // An array of links to display. Assiging variables to views is completely 20 // asyncronous. Variables can be set in any order, and can be any type 21 // of data, including objects. 22 $welcome->links = array 23 ( 24 'Home Page' => 'http://kohanaphp.com/', 25 'Documentation' => 'http://doc.kohanaphp.com/', 26 'Forum' => 'http://forum.kohanaphp.com/', 27 'License' => url::base(FALSE).'Kohana License.html', 28 'Donate' => 'http://kohanaphp.com/donate.html', 29 ); 30 31 // Using views inside of views is completely transparent. In the welcome 32 // view, printing the $content variable will render the welcome_content view. 33 $welcome->content = new View('welcome_content'); 34 35 // Using render(TRUE) forces the view to display now, instead of 36 // returning an HTML string. 11 37 $welcome->render(TRUE); 12 38 } 13 39 40 public function _default() 41 { 42 // By defining a method called _default, all pages routed to this controller 43 // that result in 404 errors will be handled by this method, instead of 44 // being displayed as "Page Not Found" errors. 45 echo 'This is a _default handler. If you expected the index page, you need to use: welcome/index/'.substr(Router::$current_uri, 8); 46 } 47 14 48 } -
releases/2.1.2/application/views/welcome.php
r1522 r2128 1 <h2>Welcome!</h2> 2 <p><?php echo $message ?></p> 3 <hr/> 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 5 6 <title><?php echo $title ?></title> 7 8 <style type="text/css"> 9 html { background: #83c018; } 10 body { width: 700px; margin: 2em auto; background: transparent url('<?php echo url::base(FALSE).'kohana.png' ?>') center 0 no-repeat; font-size: 76%; font-family: Arial, Verdana, sans-serif; color: #111; line-height: 1.5; text-align: center; } 11 div, h2, a, p, code, ul { font-family: inherit; color: inherit; padding: 0; margin: 0; text-align: baseline; text-decoration: none; } 12 h2 { padding: 200px 0 0; } 13 a { text-decoration: underline; } 14 ul { list-style: none; padding: 1em 0; } 15 ul li { display: inline; padding-right: 1em; } 16 ul li:before { content: '» '; } 17 code { color: #381a0c; } 18 p.intro { padding: 1em 0; font-size: 1.2em; } 19 p.copyright { font-size: 0.8em; text-transform: uppercase; color: #44640b; } 20 </style> 21 22 </head> 23 <body> 24 25 <h2><?php echo $title ?></h2> 26 <?php echo $content ?> 27 28 <ul> 29 <?php foreach ($links as $title => $url): ?> 30 <li><?php echo html::anchor($url, $title) ?></li> 31 <?php endforeach ?> 32 </ul> 33 34 <p class="copyright">Rendered in {execution_time} seconds, using {memory_usage} of memory<br/>Copyright ©2007-2008 Kohana Team</p> 35 36 </body> 37 </html>
