[eluser]exit[/eluser]
There are built in helper for this such as img(), link_tag(), anchor() etc. But if you want to you can use base_url() for linking to files on your webserver (use site_url() for linking to CI pages).
Example of linking to a javascript file:
Code:
< script type="text/javascript" src="<?=base_url()?>include/js/example.js">< /script>
Example of linking to an image file:
Code:
< img src="<?=base_url()?>images/example.png" alt="example" />
Example of a <a> CI link:
Code:
< a href="<?=site_url()?>archives/news">News archive</a>
Example of a <a> link to a lokal .php or .html file on the webserver
Code:
< a h ref="<?=base_url()?>include/example.php">Example</a>
The reason for using site_url() instead of base_url() is quite simple.
site_url() will include the index_page you've chosen in config.php. If you are using mod_rewrite and
Code:
$config['index_page'] = '';
both functions will return the same result, but it's best to keep it correct in case of future changes.