Welcome Guest, Not a member yet? Register   Sign In
routes issue
#11

[eluser]xwero[/eluser]
Like i said i had some other experiences with the function names. If it works for you, you don't have to worry about that.

And if you remove the route and use the index function snippet i adjusted, does it work then?
#12

[eluser]AtlantixMedia[/eluser]
I'm confused. if I use this

Code:
function index()
    {
        $this->Pick($this->uri->segment(3));
    }

what should be the testing url like?
#13

[eluser]xwero[/eluser]
http://www.domain.com/info/strategy/sketches that should output sketches
#14

[eluser]AtlantixMedia[/eluser]
ok. then, it doesn't work. it throws a 404 error
#15

[eluser]xwero[/eluser]
and if you add the route
Code:
$route['info/strategy/(.*)'] = 'info/strategy/index/$1';
but then you have to use segment 4.

But the question is why it needs to go to the pick function if the index is only a pass through method? Why not do the output in the index function?

Sorry if the ways i take are a bit sketchy i'm trying to figure out why the previous solutions don't work.
#16

[eluser]AtlantixMedia[/eluser]
I didn't know index fuctions could take parameters?
#17

[eluser]xwero[/eluser]
Why not? it is a method like any other. The only thing that makes it different that it is build in as the default method for the url routing so you don't have to add it if you only call the controller form the url. If you want to add parameters you have to add the index segment to the url.
#18

[eluser]AtlantixMedia[/eluser]
ok. this is what I have now

Code:
$route['info/strategy/(.*)'] = "info/strategy/index/$1";

    //=======================        
    function index()
    //=======================    
    {
    $this->Pick($this->uri->segment(3));

    }

    //=======================        
    function Pick($strategy = 'project-discovery')
    //=======================    
    {
          echo $strategy;
        }

testing with url http://www.domain.com/info/strategy/sketches IT WORKS!!!! but shouldn't $this->Pick($this->uri->segment(3)); be $this->Pick($this->uri->segment(4)); instead?
#19

[eluser]xwero[/eluser]
I think that is the rerouted segment. $this->uri->segment(3) should be the same as $this->uri->rsegment(4), if i'm correct i never used the rsegment method.




Theme © iAndrew 2016 - Forum software by © MyBB