tags:

views:

215

answers:

3

I'm new to CI & PHP.

I have an auth library included, and works great stand-alone.

I simply want to have the login form load as a view inside another view...is that weird?:

I'm quasi-templating:

index:

$this->load->view('head_content');
$this->load->view('stuff');
$this->load->view('footer');

Inside the stuff view:

<stuff></>
$this->load->view('login_view');
<morestuff></>

I just want the login form to show up on the front page, and then tie into the auth system...

+1  A: 

You have to load the login view in the controller, and then pass the data to the stuff view.

In the controller:

$this->load->view('head_content');
// the line below will save the output of the login view to $data['login']
// instead of outputting to the screen
$data['login'] = $this->load->view('login_view', '', TRUE);
$this->load->view('stuff');
$this->load->view('footer');

In the stuff view:

<stuff>
<?php echo $login; ?>
<morestuff>
jimyi
There is something within the controller for this library that keeps me from loging in from any other page but the actual login view...
Kevin Brown
Can you clarify?
jimyi
Sorry, I'm a bit confused myself...Basically, this didn't work. When I try to login with this lib, it just redirects me to the actual login page...I really have no idea what to say! Perhaps you can take a look at the link?
Kevin Brown
A: 

In the page Views, at the bottom, check out the section Returning views as data

Virat Kadaru
A: 

I've just recommended this but I'm going to recommend it again:

http://codeigniter.com/forums/viewthread/77279/ Django-like template inheritance helper for CodeIgniter.

I use this on ALL of my CI projects and it makes things like this stupidly easy.

amr