Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14346

Calling multiple header/footer template and setting in route

$
0
0
Hello everyone
I am new to codeigniter and want to use it for a fairly large project. I intend to use two different bootstrap template.
The first one is working but I don't understand why the second is'nt.
below is the controller code
PHP Code:
?php
    class Pages 
extends CI_Controller{
 
     public function view($page 'home'){
 
       if(!file_exists(APPPATH.'views/pages/'.$page.'.php')){
 
         show_404();
 
       }
 
       $data['title'] = ucfirst($page);
 
       $this->load->view('templates/header');
 
       $this->load->view('pages/'.$page$data);
 
       $this->load->view('templates/footer');
 
     }

 
     public function iview($page 'volunteers'){
 
       if(!file_exists(APPPATH.'views/ipages/'.$page.'.php')){
 
         show_404();
 
       }
 
       $data['title'] = ucfirst($page);
 
       $this->load->view('templates/iheader');
 
       $this->load->view('ipages/'.$page$data);
 
       $this->load->view('templates/ifooter');
 
     }
 
   }
 
?>
Below is the change I made in the application/config/routes.php

Quote:$route['default_controller'] = 'pages/view';
$route['(:any)'] = 'pages/view/$1';
$route['ipages/(:any)'] = 'ipages/iview/$1';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

Viewing all articles
Browse latest Browse all 14346

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>