CodeIgniter Forums
uri segments question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: uri segments question (/showthread.php?tid=25048)



uri segments question - El Forum - 11-29-2009

[eluser]hcker2000[/eluser]
I know the usual model is /controller/method/param1/param2/ etc... What I am wanting to do is find all parameters after param1 as after param1 there could be any number of parameters.

This is for a gallery that I am working on so here are a few examples.

This would be an example of just going to the gallery no sub directories.
/gallery/1/

This would be with sub directories.
/gallery/1/art
/gallery/1/art/photos

the 1 is a record id in a database. That record contains the path to that galleries directory.

So far the only think I can think of is to do this.
Code:
$tmp = func_get_args();

and that does not seem to contain the segments I am looking for.


uri segments question - El Forum - 11-29-2009

[eluser]überfuzz[/eluser]
Have you tried using the uri class?

URI - help you to find segments.


uri segments question - El Forum - 11-29-2009

[eluser]hcker2000[/eluser]
Thanks I think thats going to have all the info that I need to get this figured out.


uri segments question - El Forum - 11-29-2009

[eluser]überfuzz[/eluser]
OK good! Now lets go slightly off topic. Lookning the url structure and the 'controllers' folder. You have the possibility to add a folder and point it out in the url.

Files and folders in the controllers folder:
Code:
controllers/admin/
gallery.php
users.php
etc.php

Now you'll reach lets say the add_picture function in the gallery controller using thie url: www.site.com/admin/gallery/add_picture


uri segments question - El Forum - 11-29-2009

[eluser]Jeremy Gimbel - Conflux Group[/eluser]
I think what you're asking about is putting controllers in subdirectories? But I'm not completely sure.

If so, yes you can certainly do that. You may need to add some additional routes to your config/routes.php file to make it work more smoothly.

Check out the Controller User Guide page for more info. It's got a section about putting controllers in subfolders.

jeremy


uri segments question - El Forum - 02-17-2012

[eluser]Genki1[/eluser]
I just wrote two functions for retrieving URI segments: http://ellislab.com/forums/viewthread/211352/