1

I am very new in Codeigniter...i have some basic ideas..but not sufficient.lets talk about the problem....

I have a static website..which will be dynamic soon.Now this static website contains css,css3 in a css forlder, javascript in javascript folder,image in images folder.Now i am wanting to set this static website into codeigniter.I copy paste the whole codes including index.php and other pages and the folders(css,javascript.images)into the view folder of codeigniter.for all of your kind information my index.php page is just like that...

<!DOCTYPE html>
<html lang="en">
<head>
<title>Home</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" media="screen" href="css/reset.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/style.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/slider.css">
<!--<link href='http://fonts.googleapis.com/css?family=Great+Vibes' 
rel='stylesheet' type='text/css'>-->
<script src="<?= base_url() ?>path/images/js/jquery-1.7.min.js"></script>
<script src="<?= base_url() ?>path/images/js/jquery.easing.1.3.js"></script>
<script src="<?= base_url() ?>path/images/js/tms-0.4.1.js"></script>
<script src="<?= base_url() ?>path/images/js/vpb_script.js"></script>
<script src="<?= base_url() ?>path/images/js/pop.js"></script>

<!--start popup window ref-->
<link href="css/colorbox.css" rel="stylesheet" type="text/css" media="all" />
<script src="<?= base_url() ?>path/js/jquery_002.js"></script>
<script>
    $(document).ready(function(){

        $(".image_show").colorbox({rel:'image_show', transition:"fade"});

    });
</script>
<!--end popup window ref-->

<script>
    $(document).ready(function(){                   
        $('.slider')._TMS({
            show:0,
            pauseOnHover:true,
            prevBu:false,
            nextBu:false,
            playBu:false,
            duration:700,
            preset:'fade',
            pagination:true,
            pagNums:false,
            slideshow:8000,
            numStatus:false,
            banners:false,
            waitBannerAnimation:false,
            progressBar:false
        })      
    });
</script>
<style type='text/css'>
/*This will work for chrome */
    #vpb_general_button{
        padding:5px 2px 4px 2px;
    }

/*This will work for firefox*/
@-moz-document url-prefix() {
    #vpb_general_button{
        padding:5px 2px 6px 2px;
    }
}
</style>
<!--[if lt IE 8]>
   <div style=' clear: both; text-align:center; position: relative;'>
     <a href="http://windows.microsoft.com/en-US/
internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode">
       <img  src="http://storage.ie6countdown.com/assets/100/
images/banners/warning_bar_0000_us.jpg" border="0" 
height="42" width="820" alt="You are     using an outdated browser. For a faster, 
safer browsing experience, upgrade for free today." />
    </a>
  </div>
<![endif]-->
<!--[if lt IE 9]>
    <script type="text/javascript" src="js/html5.js"></script>
    <link rel="stylesheet" type="text/css" media="screen" href="css/ie.css">
<![endif]-->
</head>
<body>
<!--<div class="bg-top">-->
<div class="bgr">
<!--==============================Wrapper=================================-->
<div class="wrapper">
<?php 
   include_once('header.php');
   include_once('navigation.php');
   include_once('slider.php');
   include_once('offers.php');
   include_once('invite.php');
   include_once('testimonial.php');
   include_once('special_item.php');
   include_once('footer.php');
   include_once('popup.php');
   ?>

and my conroller is like that...

<?php
class Site extends CI_Controller
{
  function home()
 {
    $this->load->view('index');
 }


}

?>

the problem is that my webpage is loading but without the design,may b its not finding the javascript or css

i know i am making a mistake here..bur i can't fix it out,please help me to fix it out..

zogo
  • 495
  • 3
  • 10
  • 24
  • You need to edit the `.htaccess`. See [this answer](http://stackoverflow.com/questions/1060733/codeigniter-loading-css) – djthoms Jun 10 '13 at 04:14

4 Answers4

3

usually we put all files like that into an "assets" folder in the application root, and then make sure to use an Asset_Helper to point to those files. This is what CodeIgniter suggests

Amrit Gautam
  • 85
  • 1
  • 5
1

The folders (css, javascript, images) should NOT be pasted into the views folder, but in the folder where your Code Igniter's index.php is. (Usually, the parent folder of the application folder, i.e., your site public root.)

J. Bruni
  • 20,322
  • 12
  • 75
  • 92
1

You can add <?= base_url() ?> to all your css link.

<link rel="stylesheet" type="text/css" media="screen" 
href="<?= base_url() ?>path/to/css/reset.css">
shin
  • 31,901
  • 69
  • 184
  • 271
0

There is a more comprehensive answer here. You may want to consider permissions issues that could be going on as a result of placing your css dir within the application/views dir. Create an assets dir outside the application dir and use the URL helper by loading it into your controller like this.

Community
  • 1
  • 1
Mr. Concolato
  • 2,224
  • 5
  • 24
  • 44