I parsed a html into Header, Sidebar, Content, Footer etc.. And main view put together.. It is working when I calling view from mycontroller/index but it isnt working when I calling view from mycontroller/method.. Pseude Code below;
Controller;
class welcome extends CI_Controller{
public function index(){
$data['content'] = "**main**_page";
$this->load->view('welcome_message',$data);
}
public function deneme(){
$data['content'] = "**another**_page";
$this->load->view('welcome_message',$data);
}
}
View;
<html>
<head>
<?php $this -> load -> view("includes/head_view");?>
</head>
<body>
<?php $this -> load -> view("includes/navbar_view");?>
<?php $this -> load -> view($content);?>
<?php $this -> load -> view("includes/footer_view"); ?>
</body>
</html>
Example Sub View
<img src="<?php base_url(); ?>assets/img/image1.jpg">
When I open below address, everything working fine, images loading
But When open below, images is not loading
http://localhost/myproject/welcome/deneme
I check the images url from Google Chrome> Page Source Code.. The link writing like that; localhost/myproject/welcome/assets/img/image1.jpg
instead of
localhost/myproject/assets/img/image1.jpg
It's adding controller name to all links how can resolve it Thank you
Where you define your base_url
it says "URL to your CodeIgniter root. Typically this will be your base URL, WITH a trailing slash":
$config['base_url'] = 'http://localhost/myproject/';