SkillAgentSearch skills...

Templix

HTML5 based Template Engine with Recursive Extends and CSS3 Selectors to work on DOM like with Jquery

Install / Use

/learn @redcatphp/Templix
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

No longer actively maintained. I work now with NodeJS and I recommand you to take a look at ReactJS, Next.JS and EJS

Templix

Templix is a powerfull markup syntax based template engine.
Features

Templix syntax

The Templix syntax is based on diple sign < and >, so if you want to use them for other purpose than opening or closing a markup declaration, you have to use their html entites equivalent which are > and <.
The templix syntax is based on PHP and HTML5/XML, but like HTML5 add the shortcut attribute to XML, Templix add the shortcut value to HTML5:

<markup "my shortcut value" />  
            

The markup between comment <!-- --> will not be parsed excepting the PHP.

onCompile binder

You can bind to templix some callback to trigger when the document is almost compiled and all its DOM is accessible.

$templix->onCompile(function($templix){  
    $templix->find('footer a')->addClass('footer-link');  
});  
            

Options

Dev

// re-compile each time  
// add indentation and line feed for code readability  
$templix->setDevTemplate(true); //default true  
  
// add time suffix parameter to local css links to avoid browser caching  
$templix->setDevCss(true); //default true  
  
// add time suffix parameter to local js scripts avoid browser caching  
$templix->setDevJs(true); //default true  
  
// add time suffix parameter to local images to avoid browser caching  
$templix->setDevImg(true); //default false  
  
// add clean callback when switch from prod to dev  
$templix->setCleanCallback(function(){  
      
});  
            

Paths

//set compile directory  
$templix->setDirCompile('.tmp/templix/compile/'); //by default  
  
//set cache directory  
$templix->setDirCache('.tmp/templix/cache/'); //by default  
  
//add mtime directory registry to use when you use "cacheSync" attribute  
$templix->setDirSync('.tmp/sync/'); //by default  
  
//set current working directories in order you want templix look for  
$templix->setDirCwd(['template/','redcat/template/']); //by default  
  
//add directories to stack of current working directories  
$templix->addDirCwd(['template/','redcat/template/',]);  
  
//the template file to display on call of $templix->display();  
$templix->setPath($file);  
            

Paths to Plugins

Paths to plugins are based on class namespace and eventually, autoloading. Each class plugin name end with the upper case of first charater of markup and start with prefix which can be a namespace (ending with \\) or simple prefix.

$prefixDefault = Templix::getPluginPrefixDefault();  
// Templix\\MarkupX\\ , Templix\\MarkupHtml5\\ , Templix\\  
$templix->setPluginPrefix($prefixDefault); //by default  
  
$templix->addPluginPrefix($prefix,$prepend=true); //equivalent to prependPluginPrefix  
$templix->appendPluginPrefix($prefix);  
$templix->prependPluginPrefix($prefix);  
            

Path relativity

The following rules are valable when you use directly PHP API display or setPath as same as you use markups include, extend, incorpore or attribute applyFile.

no prefix - look in each working directories of template and each parent templates

<include "my-template.tml">  
            

"./" prefix - look in priority in same directory than the current template

<include "./my-template.tml">  
            

"/" prefix - look in priority in at root of working directories in order the

View on GitHub
GitHub Stars6
CategoryDevelopment
Updated3y ago
Forks1

Languages

PHP

Security Score

60/100

Audited on Jan 28, 2023

No findings