Skip to content

black-lotus/CodeIgniter-Template

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Requirements

  • CodeIgniter 2.0.0+
  • PHP 5.2.0+

Install via sparks

$ php tools/spark install -v1.0.3 codeigniter-template

Usage

copy file into correct directory.

$ cp config/template.php application/config/
$ cp libraries/template.php application/libraries/

you can reference layout example file (template/layout.php)

Set default template layout and put layout file into application/views directory

$config['template_layout'] = '../template/layout';

Initialize template library

$this->load->library("template");

add css path

$this->template->add_css("http://xxxx/index.js", "screen");

add javascript path (put the file on bottom if the second parameter is set true, default is false)

$this->template->add_js("/asset/js/index.js", TRUE);

add script (put the script on bottom if the second parameter is set true, default is false)

$script = <<<EOT
$(document).ready(function () {  
    console.log("ready");
});
EOT;
$this->template->script($script, TRUE);

add meta tag

$this->template->add_meta_tag("og:title", "Test Title", 'property');
// it will output
<meta property="og:title" content="Test Title" />

add or change meta description

$this->template->add_meta_description("Your site description");

add or change meta keywords

$this->template->add_meta_keywords("your site keywords");

add title segment

$this->template->add_title_segment("test");
// it render output
<title>test | your site title</title>

render output (return output data if the second parameter is set true)

$this->template->render("index");

Copyright

Copyright (C) 2014 Bo-Yi Wu ( appleboy AT gmail.com )

Copyright (C) 2015 Romdoni Agung Purbayanto

About

A Lightweight Codeigniter Template Libray

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%