0
votes

Hi evrybody ‘im new to codeigniter and to MVC model as well, I need help to get my project working couse i’ve got this issues:

1) i’m in the main page and i clik on the link of the “about” page, the css file does not seems to load. and even if i include the css in the head section the images are still missing in the page.

2) in the configure file i’ve set the $config[‘base_url’] = ‘’; $config[‘index_page’] = ‘index.php’; now if i’m in the about page and i clik again on the about link the link it’s missing becouse i set the link in the menu: About and so the index.php it’s loaded twice: localhost/mywebsite/index.php/index.php/about. i could set the condition to cut the link if i’m in the page i need but i would like to know if there is a more polite solution and hope that the solution it’s not to put my hands in to the mod_rewrite .

I’ll like codeigniter because seems to be easy to configure and so really portable. and even if it’s simple i can’t figure out how to solve this issues

Thank you everybody for your time!

3
2) Are you using site_url() to generate your links? Maybe the base_url has to start with a `` otherwise. And either way, you really should remove that index.php part from the url using a mod_rewrite - David Mulder
You are probably loading your resources from application folder, i recommend to put this folder to root directory where your index.php is located, if so (not to mention the security) you will have easy access to your css like <link rel="stylesheet" type="text/css" href="/resources/css/file.css"> - MyMomSaysIamSpecial
i used <?php echo site_url()?> to generate root url. it works. Application folder and css folder are in same directory. - maskapsiz

3 Answers

0
votes

Even i a newbie to CodeIgniter. I was facing the css problem. I added the css files in separate folder located at the root directory. I solved the problem by adding $this->load->helper('url'); in the controller function of the page.

0
votes

You need to set $config['base_url'] in config.php to http://www.yourdomain.com and provide full path when linking css to the page like this :

<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>resources/css/file.css">

0
votes

just add

> <?php echo base_url();?>

before or or URL link

> (example: <script src="<?php echo
> base_url();?>assets/js/jquery-1.7.1.min.js"></script>)

to load the link to all page and separate the header and footer in separate file which could help you a lot minimize the page content.