Welcome Guest, Not a member yet? Register   Sign In
Problems with css links
#1

[eluser]Julius Romo[/eluser]
Hi !

This is my first post in a new world called Codeigniter (at least, new for me).

My files structure is as this:

/htdocs

--/fw
-----/application
---------/config
---------/controllers
-----/cache
(....)
--/games/game1/
-----/user_guide
-----index.php

My problem is calling css files...

Where would be the logical place to place them? Dub-dir in views? Sub-dir in fw?

And how may I call them? I have tried with some posts here, but I couldn't get it.

Thank you very much.
#2

[eluser]jedd[/eluser]
Greetings, and welcome to the CI forums.

I think the most popular place is in a sub-directory at a peer to system. Often people create a directory at that level called assets and that's where their javascript, stylesheets, etc live. (In their own sub-directories too, is neater).

You have a .htaccess at that level that protects your assets directory from being mis-interpreted, eg:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|robots\.txt)
RewriteRule ^(.*)$ /devel/pdb3/index.php/$1 [L]

In my case, of course, my project lives at ... devel/pdb3

And within your views you can call the stylesheet thus:
Code:
<html>
<head>
<?=link_tag('assets/stylesheets/style.css')?>
...
#3

[eluser]gyo[/eluser]
jedd is totally right, and it's also a good practice to keep the system dir outside the doc root, if you have permissions to do it.

byee
#4

[eluser]Julius Romo[/eluser]
Thank you very much.

I am looking if I can take out system dir.... In local, I can (of course), but I'll see if I can do in my hosting.

By the way, just tell that I'm working in a medieval game (from 1 to "infinite" players), as MTW2 (with no strategical battles). When the game reach 0.1 version, i'll show....

I think CI will make easier my work.
#5

[eluser]jedd[/eluser]
Quote:By the way, just tell that I'm working in a medieval game ...

Excellent - it's much easier to have an actual project like this to work on when you're learning this stuff. We look forward to seeing the 0.1 pre-alpha release!




Theme © iAndrew 2016 - Forum software by © MyBB