How to Integrate Custom template to Codeigniter?

PHP WEB DEVELOPER

Before going to topic we need to know the folder structure of Codeigniterimg1
Step1:
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

Settemplate.php

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

CI=& get_instance();
$this->CI->load->library("template");
}
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->set_template("maintemp");
$this->CI->template->write ('content',$content);
$this->CI->template->write ('login',$login);
$this->CI->template->write ('title',$title);
$this->CI->template->render();
} 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->set_template("innertemp");
$this->CI->template->write ('content',$content);
$this->CI->template->write ('menu',$menu);
$this->CI->template->write ('title',$title);
$this->CI->template->render();
}
}
?>

Need to add Template.php that look like below


class CI_Template {

var…

View original post 1,757 more words

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s