A Lightweight Codeigniter Template Libray
PHP
Switch branches/tags
Clone or download
appleboy auto load html helper.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Latest commit 7e2bd55 Sep 24, 2014
Permalink
Failed to load latest commit information.
config auto load html helper. Sep 24, 2014
libraries add overloading class. Apr 21, 2014
template update template default layout, Sep 24, 2014
README.mkd update readme Sep 24, 2014
spark.info update spark version. Sep 24, 2014

README.mkd

Requirements

  • CodeIgniter 2.0.0+
  • PHP 5.2.0+

Install via sparks

$ php tools/spark install -v1.0.4 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 meta tag

$this->template->add_meta_tag("og:title", "Test Title", 'property');
// it will output
<meta property="og:title" content="Test Title" />
$this->template->add_meta_tag("keywords", "some keywords");
// it will output
<meta name="keywords" content="some 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 )