Where to place resources? |
[eluser]lszanto[/eluser]
This may sound dumb but I can't work out where I should place my images and stylesheets so that I can access them from the views file when the page is executed and complied. Any help is appreciated and thanks in advance.
[eluser]nmweb[/eluser]
I put them in an asset folder at the same level of the index.php file. I then put in a <base href="base.com"/> to get all relative urls right and stuff.
[eluser]Armchair Samurai[/eluser]
I set up my apps like this, keeping images and stylesheets in the docroot like a normal webpage: Code: |- app Code: <!-- In a view -->
[eluser]danoph[/eluser]
I wrote an article on this a while ago called . If you want to remove index.php from your URI with routing and also use a .htaccess file, things get a little tricky and my article explains how to remove index.php while still allowing access to your images, css, javascript folders, etc.. Build Your First Web2.0 App with PHP, Ajax, and CodeIgniter
[eluser]Michael Wales[/eluser]
I create the following folders at the root level: css js images I then link to those items using base_url() so I have absolute links, you could always just use a relative from root. Absolute: Code: <img src="<?= base_url(); ?>images/home.png" /> Relative: Code: <img src="/images/home.png" /> |
Welcome Guest, Not a member yet? Register Sign In |