I have started learning Code Ignitor and I am very impressed, and have had an easy time. The only issue I haven't been able to figure out is how to reference images, javascript, and CSS. I have each as a folder (css,js,img) in the root folder. This works fine for my default view, but breaks with the sub views. How am I supposed to handle this the "code ignitor" way?
there is no "codeigniter way" in HTML, because codeigniter is PHP server-side framework, while your problem is client side related
just always use an absolute path to your resources.
/css/styles.css
/js/query.php
/img/news/566.gpg
will always be fine
note that /
stick at the left. that means "root" of the site, and a path, built from the root, called "absolute", which mean "always works from anywhere".
Always use absolute path for both filesystem operations and virtual server resources
$this->load->helper('html');
echo img('absolute_path_to_image_relative_to_document_root');
echo link_tag('absolute_path_to_style_sheet_relative_to_document_root');
You are free to handcode these tags as in the other answer but if you change your url, or want to install the same code on a different url, you have to change them all by hand. This way all you have to do is change the configuration.
If you use the helper function, you do not use the leading slash either as CI will stick it in for you. what you will end up with is a true absolute url of the form http://mysite.com/images/pic1.jpg
from the input echo img('images/pic1.jpg');