Welcome Guest, Not a member yet? Register   Sign In
Routing problem
#1

[eluser]hostingx[/eluser]
Hello all!

Problems again,

When people add comments to my blog, i want them to be send back to the blog item, but here comes the problem, when i use the validation class/helper, i need to use: $this->load->view('viewname');

But that means i cant give an ID with the uri, so the application knows what blog entry he need to load,

here the code i have untill now:

Code:
function add_comment()
    {
        $this->template['link'] = 'home';
        $this->template['title'] = 'Add comment';
        
        $this->load->library('validation');
        
        $rules['name']         = "required";
        $rules['email']     = "required|email";
        $rules['message']     = "required";
        
        $fields['name']        = 'Name';
        $fields['email']     = 'Email';
        $fields['message']    = 'Message';
            
        $this->validation->set_error_delimiters('<fieldset id="error">', '</fieldset>');
        $this->validation->set_rules($rules);
        $this->validation->set_fields($fields);
        
        if ($this->validation->run() == FALSE)
        {
            $this->_run('item'.$this->uri->segment(3));    
        }
        else
        {
            $blog_entry = array(
                'name' => $this->input->post('name'),
                'email' => $this->input->post('email'),
                'entryid' => $this->uri->segment(3),
                'message' => $this->input->post('message'),
                'date'    => date('Y/m/d')
            );
            if ($this->blog_model->Add_comment($blog_entry))
            {
                $this->template['report'] = 'Your comment was succesfully added';
                $this->_run('item'.$this->uri->segment(3));        
            }
            else
            {
                die ('Error, something went wrong, please try again!!!!');
            }
        }          
    }

I hope you people can help me out :o


Messages In This Thread
Routing problem - by El Forum - 01-02-2008, 03:44 PM
Routing problem - by El Forum - 01-02-2008, 04:16 PM
Routing problem - by El Forum - 01-02-2008, 04:19 PM



Theme © iAndrew 2016 - Forum software by © MyBB