Welcome Guest, Not a member yet? Register   Sign In
Multiple Level URLs?
#1

[eluser]heavener[/eluser]
Okay, so I know how to create URLs (like http://example.com/page/) by creating a controller and including views within it.

But how do I create URLs with more than one depth level of pages (like http://example.com/page/another/page)?

Anyone know? :question:

Thanks all.
#2

[eluser]TheFuzzy0ne[/eluser]
You objective doesn't make a great deal of sense to me, however, [url="http://ellislab.com/forums/viewthread/106502/"]my alternate URI syntax library[/url] might help you.
#3

[eluser]JayTee[/eluser]
Check the user guide for the url helper: http://ellislab.com/codeigniter/user-gui...elper.html

Specifically, you can go as deep as you want with the anchor() function:
Code:
<?php
echo anchor('page/another/page','Go here');
//produces <a href="http://www.example.com/page/another/page">Go here</a>
?&gt;
#4

[eluser]jdfwarrior[/eluser]
call me crazy, i think hes referring to functions. the first step is the controller, second is which function in the controller, third and on are variables passed
#5

[eluser]JayTee[/eluser]
[quote author="jdfwarrior" date="1235988770"]call me crazy, i think hes referring to functions. the first step is the controller, second is which function in the controller, third and on are variables passed[/quote]
jdfwarrior, you're crazy

I guess I didn't read the post closely enough. If you **really** wanted to have sub-controllers/functions like the OP describes - it seems a bit silly. But to answer the question; I guess one way would be to treat the parameters as part of a redirect:

URL: http://www.example.com/controller1/metho...r2/method2

Controller1:
Code:
//in this case, would redirect the user to http://www.example.com/controller2/method2
function method1()
{
  $controller = $this->uri->segment(3);
  $method = $this->uri->segment(4);
  redirect($controller.'/'.$method);
}




Theme © iAndrew 2016 - Forum software by © MyBB