0

I want to create a routing in Kohana Framework Version 3.3.1.

I want URL like http://www.test.com/male/London and internally they will act like below URL-

http://www.test.com/list/search/London

I want to hide the controller and action name from the URL.

Any help is greatly appreciated.

2 Answers2

0

This can be accomplished by using routes in bootstrap.php and/or a module's init.php file.

For example, you could set up a route for (male/<location>) and then your default controller would be list and the action search.

You could then access the location within the controller/action by using $this->request->param('location'); to be used in whatever DB query you need it.

Confused? Have a read through this section of Kohana Docs and it should all make sense.

SigmaSteve
  • 664
  • 6
  • 25
0

You have to do two changes in your file:

    1. Bootstarp file :

      Route::set('list', 'male/<id>' )
      ->defaults(array(
      'controller' => 'list',
      'action'     => 'search',
      ));` 
      
    1. And second is you can make your link like

      href="<?php echo URL::site('male/'.id, TRUE) ?>">
      

And this route file should above at your default route file.

scott_lotus
  • 3,171
  • 22
  • 51
  • 69