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
How to create an view that's loading multiple views.
  • Hey guys,

    I have searched the web all over it but i didn't find the right answer, i want to create one view that load's multiple views in it. So for example i want to create some pages in my database, for example an page thats's called (contact) and in this column i want to place some text. So for example when somebody is visit my website 'yourwebsite.com/contact' the contact page needs to appear.

    Do i need to do something with the Kohana Routes? I don't know how to do that.

    So: one controller, one view and multiple views selected from the database.

    Route::set('default', '(<controller>(/<action>(/<id>)))') ->defaults(array( 'controller' => 'welcome', 'action' => 'index', ));

  • The controller passes the views selected from the database (by the model) to the main view.

  • But do i need to use routes? How can i rewrite the url? Can you give me some examples?

  • Seems you want subrequests:

    $view = View::factory('home');
    $view->contact = Request::factory(Route::url('contact-info'))->query(array('location' => 'NY'))->execute();

    Should the multiple views be public accessable? Are they a separate ressource?

    Specify as many routes as you need, don't try to catch all with one.

  • yes the views need to be public accessable, thanks for the example.

Howdy, Stranger!

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

In this Discussion