Welcome Guest, Not a member yet? Register   Sign In
Rails-like inline partials? [solved]
#1

[eluser]Lorin Tackett[/eluser]
I've gotten really used to the rails way of including partials. Is there a similar way to do this with CI?

Code:
render :partial => 'path/to/partial'

I've got something like this in my controller

Code:
$this->load->view('layouts/application_header');
$this->load->view('index', $var_to_be_passed_to_form);
$this->load->view('layouts/application_footer');

That's fine and good, but inside the index view I'd like to add a partial for a form, which accepts variables passed from the controller. So inside the view is there a CI way to include that partial? I hesitate to use something like:

Code:
include = "path/to/partial.php";

Thanks;
#2

[eluser]sikkle[/eluser]
more than one way to handle stuff there.

If you just want view partial, you can load $this->load->view('viewdir/viewfile');

or if you want complete independant partial including as a module, give a look to HMVC or Matchbox.

see ya around.
#3

[eluser]Lorin Tackett[/eluser]
a note: using an include in the view file works fine. I'm more curious if there was a function or helper for CI that does this.
#4

[eluser]Lorin Tackett[/eluser]
[quote author="sikkle" date="1206033526"]If you just want view partial, you can load $this->load->view('viewdir/viewfile');[/quote]

Y'know, I hadn't even tried just using that in the view. I'm having a Durrr moment here. Yeah, that's exactly what I needed. Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB