CodeIgniter Forums
Controllers in sub-folder - 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: Controllers in sub-folder (/showthread.php?tid=2902)



Controllers in sub-folder - El Forum - 08-30-2007

[eluser]Nikhil Vijayan[/eluser]
I am now creating a website with member side and admin side using ci.

I created a folder called admin in the controllers folder.

Then created a controller named members inside the admin folder to view/edit/delete members.

The default index function is working when i access

Quote:http://site/admin/members

but when i call the member function view

Quote:http://site/admin/members/view

i am getting a 404 Page not Found error.

Anybody please help to solve this problem.


Quote:I Corrected it. The View function was renamed to View2 . This made it work properly
Is this view function a reserved or something... ???



Controllers in sub-folder - El Forum - 08-30-2007

[eluser]xwero[/eluser]
Yes it is if you are using php4.

Reserved Function Names


Controllers in sub-folder - El Forum - 08-31-2007

[eluser]Nikhil Vijayan[/eluser]
Another Problem

My css file is placed in the root as css/main.css

all the pages link to it using css/main.css

but the views in admin folder doesn't show css style ..

ANY idea ?

How can i correct it


Controllers in sub-folder - El Forum - 08-31-2007

[eluser]NemetraL[/eluser]
As much as possible (meaning for all that kind of links), try the abolute paths using
Code:
<?php echo site_url(); ?>path/to/css/file
This way, it should work.
Remember to auto include the url helper first in the application/config/autoload.php file, otherwise you won't have access to
Code:
site_url();



Controllers in sub-folder - El Forum - 08-31-2007

[eluser]Nikhil Vijayan[/eluser]
Thanks Nemetral. Your idea works.

I temporarily solved the problem by placing css file inside view folder and using

Code:
<style>
<? $this->load->view('main.css'); ?>
</style>

changing to site_url() method.


Controllers in sub-folder - El Forum - 09-01-2007

[eluser]tinawina[/eluser]
Hi - not sure if this will help you (it did me). Check out this thread re: modular separation:

http://ellislab.com/forums/viewthread/46669/

The code you need is available through the CI wiki - search on modular separation.


Controllers in sub-folder - El Forum - 09-01-2007

[eluser]esra[/eluser]
I use the same method suggested by NemetraL, but there is also a forum post about an assets_helper that allows you to define the paths to your css, image, and javascript files.