Displaying the blog pagetitle as a url in codeigniter php


I am having a blog page where the blogs are inserted from admin panel and blog title will be inserted into new column as separated by " - " if there are spaces between the page titles.For example if the page title is " welcome to something " then in the database it is will be inserted into two columns. In once column it will be inserted as same and in other column it will be inserted as welcome-to-something.

when clicking on readmore button i need to display in url as (www.example.com/blob/article/welcome-to-something) in this format i need to display the url.

Here is the code:


public function index()   {   $this->load->model('blogs_model');    $data["records2"] = $this->blogs_model->get_all_blogs($config["per_page"] $page);   $data['mainpage'] = "blog";   $this->load->view('templates/template'$data);   }
public function article()   {   $this->load->model('blogs_model');   $data['records2']= $this->blogs_model->getblogsdata($this->uri->segment(3));    $data['mainpage']='blogs';   $this->load->view('templates/templatess'