Problem in calling views - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Problem in calling views (/showthread.php?tid=63074) |
Problem in calling views - rhyszz - 09-23-2015 Good day, I'm having problem with calling the views. maybe this is a noob question but please help me. let say: view * header.php * homepage.php * iiner_homepage.php Controller *homepage.php Contorller (homepage.php) PHP Code: function index(){ In calling my inner page function my URL would be localhost/CI/homepage/call_inner_page my problem is when i try to include the header.php file in my inner_homepage i got error in linking other files. inner_homepage.php (VIEW) PHP Code: <?php include_once('header.php'); but everything in the header file is broken link. like for example i put a logo Code: <img src="assets/img/logo.png" /> URL: localhost/CI/assets/img/logo.png but when i run it in my inner homepage the URL like this URL: localhost/CI/homepage/assets/img/logo.png thanks in advance guys RE: Problem in calling views - DEV03-ROMAIN - 09-23-2015 (09-23-2015, 12:41 AM)rhyszz Wrote: Good day, I think you should read the Ci user guide here http://www.codeigniter.com/user_guide/ in your case your answer is here http://www.codeigniter.com/user_guide/helpers/url_helper.html?highlight=site_url#site_url RE: Problem in calling views - Dracula - 09-24-2015 (09-23-2015, 12:41 AM)rhyszz Wrote: Good day, Replace PHP Code: <?php include_once('header.php'); ?> With PHP Code: <?php $this->load->view('header'); ?> |