• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with bootstrap - need help to integrate

#1
Hi,

I've done my usual ... that is not set up a new CI project for over a year and now I've forgotten how to integrate bootstrap into it.

I've got a folder under 'application' called assets.

Assets has 3 sub-folders: css, fonts, js. These folders contain all the bootstrap and jquery files I'll need.

In my view template I have the following:

Code:
<link rel="stylesheet" href="<?php echo base_url("assets/css/bootstrap.css"); ?>" />
<link rel="stylesheet" href="<?php echo base_url("assets/css/style.css"); ?>" />


<script type="text/javascript" src="<?php echo base_url("assets/js/jquery-1.11.2.min.js"); ?>"></script>
<script type="text/javascript" src="<?php echo base_url("assets/js/bootstrap.js"); ?>"></script>  
<script type="text/javascript" src="<?php echo base_url("assets/js/popup.js"); ?>"></script>  

which I'd hoped would be enough to find and use the files I need.

Problem is, when I load the site there doesn't seem to be any of the bootstrap formatting being used.

When I click on view page source and click on any of the links in the html - which looks like this:
Code:
<link rel="stylesheet" href="http://my.info/assets/css/bootstrap.css" />
<link rel="stylesheet" href="http://my.info/assets/css/style.css" />


<script type="text/javascript" src="http://my.info/assets/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="http://my.info/assets/js/bootstrap.js"></script>  
<script type="text/javascript" src="http://my.info/assets/js/popup.js"></script>  
I get a 404 not found page.

Can someone tell me what I've missed?

Thanks in advance.
Reply

#2
The "assets" folder should be in the document root folder not in the application folder. Or you could add "application" to the path
Code:
<?php echo base_url("application/assets/css/bootstrap.css"); ?>

If the page is being viewed directly in a browser the "base_url" is not necessary. You can change the links to be

Code:
<link rel="stylesheet" href="/assets/css/bootstrap.css" />

Hope that helps,
Scott

(12-07-2016, 05:20 AM)blackbulldog Wrote: Hi,

I've done my usual ... that is not set up a new CI project for over a year and now I've forgotten how to integrate bootstrap into it.

I've got a folder under 'application' called assets.

Assets has 3 sub-folders: css, fonts, js. These folders contain all the bootstrap and jquery files I'll need.

In my view template I have the following:

Code:
<link rel="stylesheet" href="<?php echo base_url("assets/css/bootstrap.css"); ?>" />
<link rel="stylesheet" href="<?php echo base_url("assets/css/style.css"); ?>" />


<script type="text/javascript" src="<?php echo base_url("assets/js/jquery-1.11.2.min.js"); ?>"></script>
<script type="text/javascript" src="<?php echo base_url("assets/js/bootstrap.js"); ?>"></script>  
<script type="text/javascript" src="<?php echo base_url("assets/js/popup.js"); ?>"></script>  

which I'd hoped would be enough to find and use the files I need.

Problem is, when I load the site there doesn't seem to be any of the bootstrap formatting being used.

When I click on view page source and click on any of the links in the html - which looks like this:
Code:
<link rel="stylesheet" href="http://my.info/assets/css/bootstrap.css" />
<link rel="stylesheet" href="http://my.info/assets/css/style.css" />


<script type="text/javascript" src="http://my.info/assets/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="http://my.info/assets/js/bootstrap.js"></script>  
<script type="text/javascript" src="http://my.info/assets/js/popup.js"></script>  
I get a 404 not found page.

Can someone tell me what I've missed?

Thanks in advance.
Reply

#3
Hi Scott,

That does help.

I have a few strands of hair left, your advice means I can hang on to them - for a while anyway.

Thanks a lot.
Reply

#4
Thanks for discussing this great matter here, really helpful.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.