How to Integrate Custom template to Codeigniter?


Before going to topic we need to know the folder structure of Codeigniterimg1
Here we need to copy images to images folder and css to css folder js to js folder of static template files
Under parent folder views we need to create child folder as templates under templates we need to create views/templates/Index.php file, then copy the static template index.html to views/templates/Index.php.
Step 2:
Move to applications/ libraries here we need to create two files i.e like below


<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class CI_Settemplate

CI=& get_instance();
public function maintemp($view, $data="", $title="Family")
$content=$this->CI->load->view($view, $data, true);
$login =$this->CI->load->view("formdata/usersearch",$data,true);
$this->CI->template->write ('content',$content);
$this->CI->template->write ('login',$login);
$this->CI->template->write ('title',$title);
} public function innertemp($view, $data="", $title="Family")
{ $content=$this->CI->load->view($view, $data, true);
$menu =$this->CI->load->view("templates/menu",$data,true);
$this->CI->template->write ('content',$content);
$this->CI->template->write ('menu',$menu);
$this->CI->template->write ('title',$title);

Need to add Template.php that look like below

class CI_Template {


View original post 1,757 more words


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s