Welcome Guest, Not a member yet? Register   Sign In
automatically load layout
#3

[eluser]ranjudsokomora[/eluser]
Hello runrun,
You could do a number of things here... Here are a few:

# 1 You could send a view variable and load a secondary view inside layout_view.php
Your controller would look like:
Code:
class Register extends controller{
    function index()
    {
       $data['secondary_page'] = "register_view";
       $this->load-view('register_view',$data)
    }
}

And your view would look like:
Code:
<html lang="en">
<head>
</head>
<body>
            <!--load my view here-->  
            <?PHP $this->load->view($secondary_page); ?>
</body>
</html>


# 2 You could break up your layout_view.php into two views, and using your controller you could load three total views. So you would have something like this:

header_view.php
Code:
<html lang="en">
<head>
</head>
<body>

register_view.php
Code:
<h1>register</h1>
    &lt;form method="post" action=""&gt;
        &lt;input type="text" name="name" value="" /&gt;
    &lt;/form&gt;

footer_view.php
Code:
&lt;/body&gt;
&lt;/html&gt;

Your controller would look like this:
Code:
class Register extends controller{
    function index()
    {
       $this->load->view('header_view');
       $this->load->view('register_view');
       $this->load->view('footer_view');
    }
}


Messages In This Thread
automatically load layout - by El Forum - 07-13-2011, 12:23 AM
automatically load layout - by El Forum - 07-13-2011, 07:40 AM
automatically load layout - by El Forum - 07-13-2011, 12:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB