Welcome Guest, Not a member yet? Register   Sign In
New CodeIgnitor question (Virtual directories equivalent)
#1

[eluser]Auzette[/eluser]
Hello, switched over from ASP.NET to CodeIgnitor and am enjoying the new methodologies and the simplicity of the system. Like it very much.

In IIS, I would set up virtual directories for certain assets (/css, /images, /js). The reason I did that is because if I had pages nested in subdirectories, I didn't want to have to change paths for each level in the nest (if a page was news/pages.aspx, for instance, I didn't want to refernce ../images, and if it was news/archive/pages.aspx, I didn't want to have to change it to ../../images). Virtual Directories did the trick for me in not having to deal with that.

In PHP, Apache, is there an equivalent approach? Generally, I notice that there isn't much nesting in CodeIgnitor examples, which is fine. I would, however, like to nest one of my pages (example: http://website/history/bios) and have it map to just the bios CIController (map to: http://website/index.php/bios, it seems). What happens when I do this is the CSS, images, and js directories are all one level off (because of the extra directory), and so the page doesn't load them.

First, can one replicate functionality of virtual directories? And two, in PHP/Apache with CI, is there a more optimal way to handle this situation than what I'm describing?

Thanks for any help.
#2

[eluser]Matalina[/eluser]
easiest way to get at "assests" - css, images, js, other files is to put them at the same level as your index.php

ie:

application
system
index.php
assest
- css
- js
- images
- files

or each folder with out the assests parent.

Then use the following code to pull the url in a view

Code:
base_url('assets/css/somecss.css');
#3

[eluser]Auzette[/eluser]
Excellent. Thanks for the info!




Theme © iAndrew 2016 - Forum software by © MyBB