I am new to code igniter and integrating bootstrap template with code igniter. i have created several pages in template already and try to integrate it with CI.
my css and js structure like below:
application
assets
css/style.css
js/min.js
img/imagename.jpg
My controller file as below
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
$this->load->helper('url');
$this->load->view('templates/header');
$this->load->view('home');
$this->load->view('templates/footer');
}
public function services()
{
$this->load->helper('url');
$this->load->helper('html');
$this->load->view('templates/header');
$this->load->view('services');
$this->load->view('templates/footer');
}
}
As per my understanding i need to create an different method for the different page so i can put it within header and footer. please let me know if i am wrong here.
I have created one folder named as templates in view and put create header.php
and footer.php
and put header and footer code in particular file.
my .htaccess file as below
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]
Than i creted a view named as home in view folder and put html code and include all js and css here like:
<link rel="stylesheet" type="text/css" media="all" href="assets/css/reset.css" />
And it work perfect.
But when i create another view as service and put css
and js
same as above than in my service view i cannot get data from header.php
footer.php
and also not load css
or js
or images.
And than i used url helper like below:
<script src='<?php echo $this->base_url();?>assets/js/jquery.colorbox-min.js'></script>
And it loads js files and css files but not get the proper view. and still header and footer files are not loaded in service view. So can i get any help from code igniter experts.