Welcome Guest, Not a member yet? Register   Sign In
Subfolders in CI?
#1

[eluser]Thefox[/eluser]
Hello, I'm new to CodeIgniter and am loving it so far. Everything is neat, clean and fast, but I can't figure out how to make 'subfolders' in CI.

What I mean by this is:

I have a website called http://www.example.com, CI is installed in http://www.example.com/ci

So right now to create a "file" I make the controller, lets call it site, and the method index. So the following:
http://www.example.com/ci/site/index.php

But i'd like to know how to create a "folder" within the site controller and within that new folder a new file. So like the following:

http://www.example.com/ci/site/subfolder-name/index.php

All help is greatly appreciated.

Thanks for your time
-Fox
#2

[eluser]steelaz[/eluser]
No need for .php (unless you want to) in your path, so to call "site" controller "index" method, you would go to http://www.example.com/ci/site/index/ , or http://www.example.com/ci/site/ , since "index" is default method.

To have a folder, just create one under "controllers" folder and place your controllers there, for example:

/controllers/admin/home.php
/controllers/user/home.php
/controllers/login.php

Will use these links:

http://www.example.com/ci/admin/home/
http://www.example.com/ci/user/home/
http://www.example.com/ci/login/
#3

[eluser]Thefox[/eluser]
Can't believe I didn't think of that! Thank you very much for the fast reply!

-Fox




Theme © iAndrew 2016 - Forum software by © MyBB