Welcome Guest, Not a member yet? Register   Sign In
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()




Theme © iAndrew 2016 - Forum software by © MyBB