Warning: session_start(): open(/var/cpanel/php/sessions/ea3/sess_e93eadf6bdc08b8166d512186b847ea6, O_RDWR) failed: No such file or directory (2) in /home/jay/public_html/wp-content/plugins/cbxwpsimpleaccounting/admin/class-cbxwpsimpleaccounting-admin.php on line 77

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/jay/public_html/wp-content/plugins/cbxwpsimpleaccounting/admin/class-cbxwpsimpleaccounting-admin.php:77) in /home/jay/public_html/wp-content/plugins/cbxwpsimpleaccounting/admin/class-cbxwpsimpleaccounting-admin.php on line 77

Warning: Cannot modify header information - headers already sent by (output started at /home/jay/public_html/wp-content/plugins/cbxwpsimpleaccounting/admin/class-cbxwpsimpleaccounting-admin.php:77) in /home/jay/public_html/wp-includes/feed-rss2.php on line 8
Kohana Examples – Technical Ebooks http://www.technical-ebooks.com Electrical, Electronic, and Software Technical Talks Sat, 17 Feb 2018 23:02:41 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.25 Rendering in Kohana 3.0.7 http://www.technical-ebooks.com/rendering-in-kohana-3-0-7/ http://www.technical-ebooks.com/rendering-in-kohana-3-0-7/#respond Thu, 12 Aug 2010 03:52:21 +0000 http://www.technical-ebooks.com/?p=47 An example of rendering in new Kohana 3:

In this example you can’t use $view->render(TRUE);

The right syntax would be: $this->request->response = $view->render();

See example below:

welcome.php

And here is yourview.php:

Loading index.php/welcome will out put:

]]>
http://www.technical-ebooks.com/rendering-in-kohana-3-0-7/feed/ 0
Some Examples http://www.technical-ebooks.com/some-examples/ http://www.technical-ebooks.com/some-examples/#respond Mon, 09 Aug 2010 10:04:26 +0000 http://www.technical-ebooks.com/?p=36 Continue reading ]]> Kohana 2nd Note:
  1. hello world! is within welcome.php located in application/classes/controller directory. It is the default controller. The code inside welcome.php is:
  2. <?php defined(‘SYSPATH’) or die(‘No direct script access.’);

    class Controller_Welcome extends Controller {

    public function action_index()

    {

    $this->request->response = ‘hello, world!’;

    }

    } // End Welcome

  3. These are some of the important files and their location to be aware of:

application/classes/controller/welcome.php

system/classes/config.php

application/bootstrap.php


Let’s create a test script and call it try1.php and upload it to application/classes/controller directory. This is the deafault controller path. The default controller is welcome.php.

try1.php is :

<?php defined(‘SYSPATH’) or die(‘No direct script access.’);

class Controller_Try1 extends Controller {

public function action_index()

{

echo ‘<p>Executing try1.php</p>’;

echo ‘<p>More paragraph.</p>’;

$this->request->response = ‘Using request response to display this line.’;

}

} // End Welcome

Some notes about try1.php:

Controller is a Kohana class. All application controllers will extend this class. Your application may have just one controller, or it may have many, depending on how it is organised. A single method, index() is defined. If the controller is invoked without a method segment, this function is called.


Ability to choose from several functions within a controller:

Create a file named application/classes/controller/hello.php with these codes in it:

<?php defined(‘SYSPATH’) OR die(‘No Direct Script Access’);

Class Controller_Hello extends Controller_Template{

public $template = ‘site’;

function action_index() {

$this->template->message = ‘hello, world! from Function index within hello.php.’;

}

function action_x() {

$this->template->message = ‘Running Function x within hello.php!’;

}

}

Create another file named application/views/site.php with these codes in it:

<html>

<head>

<title>We’ve got a message for you!</title>

<style type=”text/css”> body {font-family: Georgia;} h1 {font-style: italic;} h2 {font-style:oblique} </style></head>

<body>

<h1><?php echo $message; ?></h1>

<h2>Note: Above comment is passed from hello.php to this site.php.</h2>

<p> This line and above line (Note: A…) are strictly being displayed from within site.php</p>

</body>

</html>

You can select with function from within hello.php to be executed by loading one of these urls:

http://yoursite.com/kohana/index.php/hello

This will run index() function of hello.php

http://yoursite.com/kohana/index.php/hello/x

This will run x function of hello.php

Site.php


Jay Kajavi

]]>
http://www.technical-ebooks.com/some-examples/feed/ 0

Warning: Unknown: open(/var/cpanel/php/sessions/ea3/sess_e93eadf6bdc08b8166d512186b847ea6, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/cpanel/php/sessions/ea3) in Unknown on line 0