Welcome Guest, Not a member yet? Register   Sign In
How to add page title in url?
#1

I'm learn Codeignite on someone else's source. How to add $title for url in this controller?
As: website/mainitems/$id/$title
Code:
class mainitems extends CI_Controller {
    
    public function __construct() {
        parent::__construct();
    }
    
    //single movie page
    public function index($param = null)
    {
        $this->load->helper("form");
        $this->load->helper('url');

        $uri_string = $this->uri->segment(2);
        $movie = explode("-", $uri_string);
        $movieID = $this->db->escape(abs(intval(end($movie))));
        
        //get movie data
        $itemsRs = $this->db->get_where("items", array("id" => $movieID));
        $movieData = $itemsRs->result();
        
        $title = $movieData[0]->title;
        
        //data - result
        $data['movie_info'] = $movieData;
        
        $this->load->view('items', $data);
    }
Reply


Messages In This Thread
How to add page title in url? - by Huskie - 09-04-2018, 08:47 AM
RE: How to add page title in url? - by Wouter60 - 09-04-2018, 10:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB