Welcome Guest, Not a member yet? Register   Sign In
Routing Help Needed
#2

First, I would not use this date format (YYYY/MM/DD) in an URL. That format would result in 5 URI segments being set. Use YYYY-MM-DD instead. That will leave you with 3 segments.

If you have a controller named Blog, add the _remap method. Check out the documentation on that.

_remap documentation

In short, the second segment in your URL will be passed as an argument, and you can then check it, and remap it to any method within your controller.

If your index method shows a list of all your blogs you could have a method get_blog($date, $blog_title) for getting that specific blog entry.

PHP Code:
public function _remap($method) {
 
   ifmethod_exists($this$method) ) {
 
       $this->{$method}();
 
   } else {
 
       $this->get_blog($method$this->uri->segment(3));
 
   }


Hope this gets you on your way

- Martin
Reply


Messages In This Thread
Routing Help Needed - by codeigniterd - 11-28-2016, 07:54 PM
RE: Routing Help Needed - by Martin7483 - 11-29-2016, 03:54 AM
RE: Routing Help Needed - by codeigniterd - 11-29-2016, 08:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB