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

[eluser]JanDoToDo[/eluser]
Hey guys,

So i have a subfolder in my controllers and i want to have a subfolder inside that but i cant seem to get it to work as it just says page cannot be found

The system would be
application/controllers/sub1/sub2/home.php

It works with files that are within the sub1 subfolder, but when i add a new subfolder it cant find the page. Do i have to do something special? Thankyou!
#2

[eluser]Sbioko[/eluser]
Read about MVC. First segment of the URL should be a controler's name and the second - name of the controller's method.
#3

[eluser]JanDoToDo[/eluser]
Umm yeah but the controllers can also be organised into folders...? Thats why I have a sub folder?? Or is this not right?
#4

[eluser]Aken[/eluser]
You can definitely use at least one tier of sub-folders. I haven't tested using more than one.
#5

[eluser]JanDoToDo[/eluser]
Ok.. Thanks for the info. Yeah.. as i said the first one works Smile but not the 2nd folder Sad maybe this is a setting somewhere?? dunno... basically what im trying to do is password protect the files inside the folder through htaccess and creating a subfolder seemed easiest! If you know another way it would also be appreciated! Smile
#6

[eluser]Aken[/eluser]
You shouldn't need a second level sub-folder if all you want to do is password protect that directory. You'd have to explain more exactly what you're trying to password protect.

Or you can implement an actual user authentication system into your application!
#7

[eluser]Tom Schlick[/eluser]
search on the forum for this ive implemented it in my code from things other people have done i just cant find it at the moment. basically it allows for unlimited sub folder depth
#8

[eluser]Sbioko[/eluser]
I think, this is not right.
#9

[eluser]David Cassidy[/eluser]
[quote author="JanDoToDo" date="1262410406"]Ok.. Thanks for the info. Yeah.. as i said the first one works Smile but not the 2nd folder Sad maybe this is a setting somewhere?? dunno... basically what im trying to do is password protect the files inside the folder through htaccess and creating a subfolder seemed easiest! If you know another way it would also be appreciated! Smile[/quote]

Instead of cluttering up your filesystem with redundant directories, why not take advantage of one of the features of the mod_auth module and use your .htaccess file to protect just the file you want to restrict access to?

Code:
<Files foo.php>
    AuthType Basic
    AuthName "Protected Access"
    AuthUserFile /usr/local/apache/passwd
    Require valid-user
</Files>

Change the filename above and add this snippet to the .htaccess file within the controller directory where it resides. Less clutter means less frustration.

If you are need of password protecting several files, have enough confidence in regular expressions and are feeling particularly brave, you can use the FilesMatch option instead. Otherwise, there is no shortage of authentication and authorization libraries for CodeIgniter - most of which are fairly simple to implement. It's simply up to you to decide whether you need a more elaborate authorization method or not.

Good luck!

[quote author="Demedes" date="1262444314"]I think, this is not right.[/quote]

MVC really only dictates how different components of the application interact with one another. The structure of your directories is really of no consequence.
#10

[eluser]JanDoToDo[/eluser]
Many thanks for your responses. Dave_C that looks like exactly what I want, I just didn't know where to put the htaccess. I don't want to develop a user system for the site as it would be overkill as this is the only file which needs protecting. It basically allows downloads from the site but it would only be given access to select people and they would not have any kind of user account so the htaccess is the easiest way.

I had previously tried to use filesmatch but it didnt work...Ill have a go with the files! Smile thankyou!




Theme © iAndrew 2016 - Forum software by © MyBB