Welcome Guest, Not a member yet? Register   Sign In
Problem with Links.
#5

[eluser]davidbehler[/eluser]
base_url only works if you are not using index.php.
Try using site_url() instead, it provides the same as base_url but includes the index.php if it's needed and it even accepts arguments:

Code:
// base_url:
echo base_url(); // http://localhost/your_ci_folder/

// site_url without index file in config.php:
echo site_url(); // http://localhost/your_ci_folder/

// site_url with index file in config.php:
echo site_url(); // http://localhost/your_ci_folder/index.php/

// site_url with index file in config.php and arguments:
echo site_url('blog/view'); // http://localhost/your_ci_folder/index.php/blog/view

I usually use anchor() or site_url() to generate links/urls that point to my controllers/functions and base_url() when generating urls to images, js files and so that are not in the application folder, e.g.
Code:
<img src="&lt;?php echo base_url().'images/test/test.png'; ?&gt;" />


Messages In This Thread
Problem with Links. - by El Forum - 10-03-2009, 11:49 PM
Problem with Links. - by El Forum - 10-03-2009, 11:51 PM
Problem with Links. - by El Forum - 10-04-2009, 12:56 AM
Problem with Links. - by El Forum - 10-04-2009, 11:13 PM
Problem with Links. - by El Forum - 10-05-2009, 12:48 AM
Problem with Links. - by El Forum - 10-14-2009, 11:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB