Skip to content

Commit

Permalink
Updated default welcome controller and views. Much more attractive now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadowhand authored and Shadowhand committed Feb 9, 2008
1 parent e81233e commit 02fb5c5
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 7 deletions.
30 changes: 30 additions & 0 deletions Kohana License.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title>Kohana License</title>

</head>
<body>

<h2>Kohana License Agreement</h2>

<p>This license is a legal agreement between you and the Kohana Software Foundation for the use of Kohana Framework (the "Software"). By obtaining the Software you agree to comply with the terms and conditions of this license.</p>

<p>Copyright (c) 2007-2008 Kohana Team<br/>All rights reserved.</p>

<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>

<ul>
<li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li>
<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li>
<li>Neither the name of the Kohana nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.</li>
</ul>

<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>

<p><small>NOTE: This license is modeled after the BSD software license.</small></p>

</body>
</html>
7 changes: 4 additions & 3 deletions application/controllers/examples.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ function index()
get_class_methods(get_parent_class($this))
);

sort($examples);

echo "<strong>Examples:</strong>\n";
echo "<ul>\n";

Expand All @@ -47,14 +49,14 @@ public function archive($build = FALSE)
$archive = new Archive('zip');

// Add welcome.php with the name of test.php
$archive->add(APPPATH.'controllers/welcome.php', 'test.php');
$archive->add(APPPATH.'views/', 'shitty/views', TRUE);

// Download the built archive
$archive->download('test.zip');
}
else
{
echo html::anchor(Router::$current_uri.'/build', 'Download welcome.php as test.php');
echo html::anchor(Router::$current_uri.'/build', 'Download views');
}
}

Expand Down Expand Up @@ -95,7 +97,6 @@ function rss()
*/
function session()
{
$this->load->database();
$s = new Session();

echo 'SESSID: <pre>'.session_id()."</pre>\n";
Expand Down
35 changes: 34 additions & 1 deletion application/controllers/welcome.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,47 @@
<?php defined('SYSPATH') or die('No direct script access.');
/**
* @package Core
*
* Default Kohana controller.
*/
class Welcome_Controller extends Controller {

public function index()
{
// In Kohana, all views are loaded and treated as objects.
$welcome = new View('welcome');
$welcome->message = 'This is the default Kohana index page. You can edit <tt>application/controllers/welcome.php</tt> now.';

// You can assign anything variable to a view by using standard OOP
// methods. In my welcome view, the $title variable will be assigned
// the value I give it here.
$welcome->title = 'Welcome to Kohana!';

// An array of links to display. Assiging variables to views is completely
// asyncronous. Variables can be set in any order, and can be any type
// of data, including objects.
$welcome->links = array
(
'License' => url::base(FALSE).'Kohana License.html',
'Home Page' => 'http://kohanaphp.com/',
'Documentation' => 'http://doc.kohanaphp.com/',
'Forum' => 'http://forum.kohanaphp.com/',
);

// Using views inside of views is completely transparent. In the welcome
// view, printing the $content variable will render the welcome_content view.
$welcome->content = new View('welcome_content');

// Using render(TRUE) forces the view to display now, instead of
// returning an HTML string.
$welcome->render(TRUE);
}

public function _default()
{
// By defining a method called _default, all pages routed to this controller
// that result in 404 errors will be handled by this method, instead of
// being displayed as "Page Not Found" errors.
echo 'This is a _default handler. If you expected the index page, you need to use: welcome/index/'.substr(Router::$current_uri, 8);
}

}
40 changes: 37 additions & 3 deletions application/views/welcome.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
<h2>Welcome!</h2>
<p><?php echo $message ?></p>
<hr/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title><?php echo $title ?></title>

<style type="text/css">
html { background: #83c018; }
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; }
div, h2, a, p, code, ul { font-family: inherit; color: inherit; padding: 0; margin: 0; text-align: baseline; text-decoration: none; }
h2 { padding: 200px 0 0; }
a { text-decoration: underline; }
ul { list-style: none; padding: 1em 0; }
ul li { display: inline; padding-right: 1em; }
ul li:before { content: '» '; }
code { color: #381a0c; }
p.intro { padding: 1em 0; font-size: 1.2em; }
p.copyright { font-size: 0.8em; text-transform: uppercase; color: #44640b; }
</style>

</head>
<body>

<h2><?php echo $title ?></h2>
<?php echo $content ?>

<ul>
<?php foreach ($links as $title => $url): ?>
<li><?php echo html::anchor($url, $title) ?></li>
<?php endforeach ?>
</ul>

<p class="copyright">Copyright &copy;2007-2008 Kohana Team</p>

</body>
</html>
5 changes: 5 additions & 0 deletions application/views/welcome_content.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<p class="intro">This is the default Kohana index page. You may also access this page as <code><?php echo html::anchor('welcome/index', 'welcome/index') ?></code>.</p>

<p>To change what gets displayed for this page, edit <code>application/controllers/welcome.php</code>.</p>

<p>To change this text, edit <code>application/views/welcome.php</code> and <code>application/views/welcome_content.php</code>.
Binary file added kohana.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 02fb5c5

Please sign in to comment.