TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Load different views
  • Hello,

    Had a small question, what is the best way to load a view into an variable. So for example i'm now loading the view 'menu' into my variable '$menu'. But how can i load the controller that controls the 'menu' view.

    Loading the menu (views) $this->template->menu = View::factory('menu')->set('menu', View::factory('menu'));

    My menu controller looks like:

    `<?php defined('SYSPATH') or die('No direct script access.');

    class Controller_menu extends Controller {

    public $template = 'index';
    public function action_index()
    {
        $view = new View('menu');
        $this->response->body($view); 
         echo 'hello, world!';
    }
    

    } `

  • Seems like you should be using the request class, and grabbing it's body?

  • Fixed it already, thanks.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion