[eluser]bigtimslim[/eluser]
I'm new to using templates and quite sure how to go about this. I have a form that I want the designer to do whatever with. I feel like it would look better to just load the whole ting in the template as a variable. This gives me weird results. Thoughts?
Code:
function index()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('name', 'Name', 'required');
$this->form_validation->set_rules('url', 'Url', 'required');
$this->form_validation->set_rules('category', 'Category', 'callback_dropdown_check');
$this->form_validation->set_rules('desc', 'Description', 'required|max_length[250]');
$this->form_validation->set_rules('keyword', 'Keywords', 'required|max_length[50]');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
if ($this->form_validation->run() == FALSE) {
$this->load->helper('form');
//Get category list and prepate for dropdown
$categories = $this->config->item('categories');
foreach ($categories as $cat) { $cats[$cat] = $cat; }
$data['message'] = $this->config->item('submit_site_message');
$form['cats'] = $cats; //meow
$data['form'] = $this->load->view('add_form_view', $form);
//$data['form'] = $this->parser->parse('add_form_view', $form);
//$this->load->view('add_view', $data);
$this->parser->parse('add_template', $data);
}
else {
if ($this->insert()) {
redirect('add');
} else {
show_error('Site could not be added.');
}
}
}
Code:
<html>
<head>
<link href="<?php echo base_url();?>public/css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="message">{message}</div>
<br />
<div id="add_form">{form}</div>
</body>
</html>