Welcome Guest, Not a member yet? Register   Sign In
Whats the best practice for website structure
#1

[eluser]Unknown[/eluser]
Newbie here!

Can anyone recommend the best directory structure for a CI website, including where to store CSS files, images and how to direct CI to find them from the view files?

For example would use the rewrite or one of the helper files take care of the paths and if so how would you configure this?

Thanks!
#2

[eluser]JayTee[/eluser]
I don't think there's a "best" way, to be honest. There are a bunch of entries in the wiki that discuss site structure and a few threads in the forum that discuss it.

My personal favorite is to use 2 folders:
public
system <-- the CI system folder, which you'd probably want to rename

The public folder contains my css, javascript, file downloads, and images
public
|-css
|-js
|-images
|_files

I use the CI helpers for generating links to everything in my views, so I don't worry much about the paths.
#3

[eluser]jdfwarrior[/eluser]
I use the same setup as JayTee. System and Public folders, with css and all in the public folder.
#4

[eluser]Unknown[/eluser]
Thanks,

I have the 'url' helper working now but i think the issue maybe the rewrite file.

I am using IIS and for some reaason this stops the 'url' helper form working, the dynamic path which is generated by the helper is completley blanc (seems to be ignored when IIS rewrite is on).

Also I am not sure if its working properly. I have had no problems in the past using IIS rewrite.

IIS Rewrite rules.

RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

Any ideas!




Theme © iAndrew 2016 - Forum software by © MyBB