Welcome Guest, Not a member yet? Register   Sign In
loading views as template variables

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?

function index()
        $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) {
            //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()) {
            } else {
                show_error('Site could not be added.');

<link href="<?php echo base_url();?>public/css/style.css" rel="stylesheet" type="text/css" />
<div id="message">{message}</div>
<br />
<div id="add_form">{form}</div>

I realize this might be a little weird for a designer not seeing the elements in the form. What is the most common way?

Neverming.. I found the third load view parameter to return as string. :red:

why dont u use any ci libray of template.

Theme © iAndrew 2016 - Forum software by © MyBB