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

Why do you need the id as well as the title in the url? The id is unique, so you can always use that to find the proper database record. If you prefer user friendly URL's, don't include the id, just the title. But be careful: the title may contain characters that are not allowed in URL's. It's better to use a "slug", basically a string that's converted to a format that is allowed in URL's.
CodeIgniter has a function for that, in the url helper: url_title().

See documentation: https://www.codeigniter.com/userguide3/h...#url_title

Obviously, you must take care that each slug is unique. Of you've got that set up, you can find the database record like this:
PHP Code:
$record $this->db->where('slug'$title)->get('posts')->row(); 

The CodeIgniter tutorial also covers the use of slugs:

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