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,

    I'm new with the Kohana framework, first of all it's lovely!

    But i had a small question, does anyone know how i can load different views in one view. So for example, i got one view (template) and in this view i want to load another view (like an other menu or something like that)

    What is the best way to program this?

  • public function action_index() { $this->request->body(View::factory('template')->set('menu', View::factory('menu'))); }

    template.php

    <html> <body> <?php echo $menu?> </body> </html>

  • Thank you Chungackguk!

    But do i need to create a new file called menu in my template 'map' or is it a controller?

  • So for example i did: $this->request->body(View::factory('template/template')->set('menu', View::factory('menu')));

    but it's not loading the menu.php in the template map: View_Exception [ 0 ]: The requested view menu could not be found

  • But do i need to create a new file called menu in my template 'map' or is it a controller?

    of course, you need to create "menu.php" in a "views" folder.

    read here http://kohanaframework.org/3.3/guide/kohana/mvc/views

  • Thanks dit that but View_Exception [ 0 ]: The requested view menu could not be found.

    But i'll read that

  • that must be done inside /applicatie/views and not system folder. Perhaps that is why.

Howdy, Stranger!

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

In this Discussion