Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

dimd13/Codeigniter-TemplateEngine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codeigniter - Template Engine v0.1

Requirements

  1. PHP 5.2 or greater
  2. CodeIgniter 2.1+

What's it?

Installation

Copy application/libraries/Template.php to your project folder.

Make sure that your application/cache folder have permissions to write (0755).

Add template to libraries autoload or load this library in your controller.

Usage

###Sample variables ####Controller:

<?php
public function index()
{
    $data = array('sample_var' => 'SAMPLE_VAR', 'var_with_html' => 'Var with <b>HTML</b>');
    $this->template->parse_view('welcome_message.php', $data);
}
?>

####View: {{sample_var}} {{!var_with_html}}

####Output: SAMPLE_VAR Var with HTML ###Boolean variables ####Controller: true); $this->template->parse_view('welcome_message.php', $data); } ?> ####View: ((ture_var))You can see this text, because ture_var set in TRUE ((/ture_var)) ((!ture_var))And you can not see this text, because ture_var not equal to FALSE((/ture_var)) ####Output: You can see this text, because ture_var set in TRUE! ###Arrays ####Controller: 'John', 'age' => 41); $data['list'][] = array('name' => 'Andy', 'age' => 17); $data['list'][] = array('name' => 'Dany', 'age' => 28); $this->template->parse_view('welcome_message.php', $data); } ?> ####View: [[list]]

NAME: {{list.name}}, AGE: {{list.age}}

[[/list]]; ####Output: NAME: John, AGE: 41 NAME: Andy, AGE: 17 NAME: Dany, AGE: 28

About

TemplateEngine for Codeigniter v0.1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages