-
Notifications
You must be signed in to change notification settings - Fork 0
TinyButStrong Template Engine
This is a template library that wraps around [url=http://www.tinybutstrong.com]TinyButStrong[/url].
[h3]FILES[/h3]
[b]application/init/init_tbswrapper.php[/b] [code] <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
if ( ! class_exists('Tbswrapper')) { require_once(APPPATH.'libraries/tbswrapper'.EXT); }
$obj =& get_instance(); $obj->tbswrapper = new Tbswrapper(); $obj->ci_is_loaded[] = 'tbswrapper';
?> [/code]
[b]application/libraries/tbswrapper.php[/b] [code] <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
require_once("tbs_class_php5.php");
class Tbswrapper{
/**
* TinyButStrong instance
*
* @var object
*/
private static $TBS = null;
/**
* default constructor
*
*/
public function __construct(){
if(self::$TBS == null) $this->TBS = new clsTinyButStrong();
}
public function tbsLoadTemplate($File, $HtmlCharSet=''){
return $this->TBS->LoadTemplate($File, $HtmlCharSet);
}
public function tbsMergeBlock($BlockName, $Source){
return $this->TBS->MergeBlock($BlockName, $Source);
}
public function tbsMergeField($BaseName, $X){
return $this->TBS->MergeField($BaseName, $X);
}
public function tbsRender(){
$this->TBS->Show(TBS_NOTHING);
return $this->TBS->Source;
}
}
?> [/code]
Besides tbswrapper.php, tbs_class_php5.php (for PHP5) or tbs_class_php4.php (for PHP4) must be present in [b]application/libraries/[/b] folder; also tbs_plugin_cache.php for caching presentation layer (it's different from CI caching system).
[h3]EXAMPLES[/h3]
Like any CI library, you can either autoload it:
[b]configs/autoload.php[/b]
[code]$autoload['core'] = array('tbswrapper');[/code]
Or, load it manually inside any controller method:
[code]$this->load->library('tbswrapper');[/code]
[h4]Example of usage :[/h4]
[b]controller[/b]
[code] [/code]
[b]view[/b]
[code] [/code]
[b]model[/b]
[code] [/code]
[h4]...[/h4]
[code] [/code]