Welcome Guest, Not a member yet? Register   Sign In
Page layout system
#2

[eluser]mrtopher[/eluser]
I tend to use more of a layout approach. So instead of having three or four templates which I load in and around my content line by line, I have a layouts folder in the views folder which has the overall look and feel and I simply load individual views in those layouts.

For example:
Code:
$page_data = array(
    'some_content' => 'some content'
);

$temp_data = array(
    'page_title' => 'Some title',
    'left_column' => $this->load->view('navigation',0,TRUE),
    'right_column' => $this->load->view('form',$page_data,TRUE)
);

$this->load->view('layouts/page_layout',$temp_data);


In regards to your validation question, I don't redirect the users. I simply make a call to the form display function from within the process function.

For example:
Code:
function display_form()
{
    // display form.
}

function process_form()
{
    $this->load->library('validation');

    // validation rules

    if($this->validation->run() == FALSE) {
        $this->display_form(); // displays form and still have access to post data.
    }
    else {
        // do processing
    }
}

Hope this helps!


Messages In This Thread
Page layout system - by El Forum - 05-15-2008, 07:09 AM
Page layout system - by El Forum - 05-15-2008, 08:01 AM
Page layout system - by El Forum - 05-18-2008, 06:13 AM
Page layout system - by El Forum - 05-18-2008, 07:24 AM
Page layout system - by El Forum - 05-18-2008, 06:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB