Welcome Guest, Not a member yet? Register   Sign In
String as an URL
#11

[eluser]georgerobbo[/eluser]
I'm really sorry but I'm still not quite understanding how to do it.

Say my database structure is as the following.

Primary_ID Title Description Thumbnail Content
1 example learning php php.jpg we're going to learn how to use php


I then have the model stalker.php autoloaded, using the function get_article.


Code:
function get_article()
    {
        $this->db->set('slug', url_title($this->input->post('Title')));
        $this->db->set('title', $this->input->post('Title'));
        $this->db->insert('articlebase');
    }

And then I have my controller named Article.

Code:
function index($slug)
    {
        $data['title'] = 'Article';
        
        $this->db->where('stalker', $slug);
        $this->db->get();
        
        $this->load->view('meta', $data);
        $this->load->view('header');
        $this->load->view('content', $data);
        $this->load->view('index', $data);
        $this->load->view('footer');
    }




Theme © iAndrew 2016 - Forum software by © MyBB