I created the main.php under layout, Then I created a separate index.php for my registration form. I want my landing page/site index page be like facebook, with a registration form and a login form on the top tool bar.
The problem I’m facing is, I don’t know how to integrate the two in the same layout. I already used the $content
for the registration form, I need to know how I can create another variable that can be used for the login form ?
Please let me know if there is any way around it. I appreciate it.
I am not able to comprehend the exact requirement of yours.
Anyway let us consider that we have a layout test in views/layouts.
<!-- for login -->
<div style="height:100px;width:800px;background:tan;">
<?php echo $login;?>
</div>
<!-- for registeration-->
<div style="height:400px;width:400px;background:aliceBlue;">
<?php echo $register;?>
</div>
Now in a controller and in some action we can do the following.
public function actionSomeAction()
{ $this->layout="//layouts/test";
$register=$this->renderPartial("register",array(),true,true);//getting the registeration form along with scripts.
$login=$this->renderPartial("login",array(),true,true);//getting loginform form along with scripts.
$this->renderFile($this->getLayoutFile($this->layout),array('register'=>$register,'login'=>$login),false);
}
If you want to embed the test layout in any other layouts like main layout,