James Douglas
James Douglas

Reputation: 736

Twitter Bootstrap Path Breaks When Not on Homepage

I am currently testing my website on the local server. I have issues with twitter bootstrap's path in my header view.

On my homepage this path works fine:

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

When I move to sub-page via link:

<a href="index.php/home_controller/getFilmDetails?id...

Which translates to:

http://localhost/www.mywebsite.co.uk/index.php/home_controller/getFilmDetails?id=114

Controller code:

$this->load->view('/header/header_home');
$this->load->view('movies_details_view',$data);
$this->load->view('footer_home');

Path to twitter bootstrap does not work, and I need to change the path to:

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

How do I make the path work on all pages?

Upvotes: 1

Views: 132

Answers (1)

kittycat
kittycat

Reputation: 15045

In your Controller do this:

$this->load->helper('url');
$this->load->view('/header/header_home');
$this->load->view('movies_details_view',$data);
$this->load->view('footer_home');

Inside you header view do this:

<link href="<?php echo base_url('/bootstrap/css/bootstrap.css') ?>" rel="stylesheet">

Upvotes: 1

Related Questions