• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calling Controller without function and set param

#1
[eluser]Unknown[/eluser]
Hello, i have a controller named as Search, well...
I want call the url like this

http://myurl.com/index.php/search/term_of_search

or

http://myurl.com/search/term_of_search

How i do this?

tks

#2
[eluser]vitoco[/eluser]
First, to remove "/index.php/" from the url, use mod_rewrite on .htaccess ( search in the wiki or the forums for this ), and to send "search/term_of_search/" to a specific method/function, use custom routes ( see rounting in user guide http://ellislab.com/codeigniter/user-gui...uting.html )

If after that, you can't make it work, please reply your specific problem here.

Saludos

#3
[eluser]uber_n00b[/eluser]
If you want to access the "term_of_search" from your controller function you can do so via:

Code:
function search($term = NULL){
     if ($term){
        //run my search with the passed term
     }
}

#4
[eluser]PhilTem[/eluser]
Possible solutions are:

1) Reading the CI User's guide observingly from beginning to end and reverse,
or
2) Routing
or
3) _remap()


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.