CodeIgniter Forums
Fatal error -> base_url() - what am I doing wrong? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Fatal error -> base_url() - what am I doing wrong? (/showthread.php?tid=9060)

Pages: 1 2


Fatal error -> base_url() - what am I doing wrong? - El Forum - 06-11-2008

[eluser]ICEcoffee[/eluser]
thanks guys, I'm going to use both of those suggestions.

I'm grateful for the active community surrounding CI.


Fatal error -> base_url() - what am I doing wrong? - El Forum - 06-11-2008

[eluser]ICEcoffee[/eluser]
this may be obvious to the experienced CI coder, but I learned this works:

Quote:<link rel='stylesheet' href='<?php echo base_url() . "styles/style.css"; ?>' type='text/css' media='screen' charset='utf-8' />

and this doesn't:
Quote:<link rel='stylesheet' href='<?php echo base_url("styles/style.css"); ?>' type='text/css' media='screen' charset='utf-8' />

ie the difference of using base_url() and site_url() in the context above.

The reason base_url() - as used above - doesn't work, is because it adds 'index.php' into the href path, which for me, doesn't work. the browser output is:
Quote:<link rel='stylesheet' href='http://localhost/ci2/index.php/styles/style.css' type='text/css' media='screen' charset='utf-8' />

I hope this makes sense.