Welcome Guest, Not a member yet? Register   Sign In
route vs redirect
#1

[eluser]cotejf[/eluser]
Hey guys,
I was thinking that route was a way to give another name to a page.

Code:
My route:
$route['portables_apple'] = "catalogue/filtre/c:10010201/t:prix_descendant/m:z00201";

The function:
Code:
function filtre($null = array()){
$params = $this->uri->segment_array();
        .....
}

I wanted to use it as a fancy url but it wont work. The param I get in my function is
'portable_apple'
instead of
'c:10010201/t:prix_descendant/m:z00201'


Is there a way using the route to call a controller/method and keep the fancy url?

Thanks
#2

[eluser]Migranux[/eluser]
Hello,
Code:
$route['portables_apple'] = "catalogue/filtre/c:10010201/t:prix_descendant/m:z00201";
should be
Code:
$route['portables_apple'] = "catalogue/filtre/10010201/prix_descendant/z00201";
and
Code:
function filtre($null = array()){
$params = $this->uri->segment_array();
        .....
}
should be
Code:
function filtre($param1, $param2, $param3){
...
}
Hope it will help you Wink
#3

[eluser]cotejf[/eluser]
mmhh... my function is already working. I use this technique because I can have from 1 to X parameters.

I can call
Code:
catalogue/filtre/c:10010201/t:prix_descendant/m:z00201/w:apple/w:imac/w:20
or simply
catalogue/filtre/c:10010201

My concern is the missing parameters pass to the function....

Thanks!
#4

[eluser]Migranux[/eluser]
Sorry Smile
$this->uri->segment_array() can't give you the informations, because it is only for the URI in your case portables_apple...
But you cn use this function :
Code:
function filtre($parameters = array()) {
    $filtres = func_get_args();
}
#5

[eluser]Aken[/eluser]
There are methods for retrieving the after route, rather than the one shown. http://ellislab.com/codeigniter/user-gui...s/uri.html
#6

[eluser]cotejf[/eluser]
@Migranux Thanks man! That's perfect and working now!

@Aken Thanks Aken, I did not know these functions and they will be usefull to me right now.

Thanks again guys.




Theme © iAndrew 2016 - Forum software by © MyBB