• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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');
    }


Messages In This Thread
String as an URL - by El Forum - 09-06-2009, 09:50 AM
String as an URL - by El Forum - 09-06-2009, 02:03 PM
String as an URL - by El Forum - 09-06-2009, 02:05 PM
String as an URL - by El Forum - 09-07-2009, 12:26 PM
String as an URL - by El Forum - 09-07-2009, 04:05 PM
String as an URL - by El Forum - 09-07-2009, 05:14 PM
String as an URL - by El Forum - 09-08-2009, 06:24 AM
String as an URL - by El Forum - 09-08-2009, 06:28 AM
String as an URL - by El Forum - 09-08-2009, 07:07 AM
String as an URL - by El Forum - 09-08-2009, 07:55 AM
String as an URL - by El Forum - 09-09-2009, 12:07 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.