1. Go to this page and download the library: Download redcatphp/templix library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// 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(){
});
//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);
foreach($node->find('img') as $img){
if(!$img->alt)
$img->alt = basename($img->src);
}
$node->find('a',0); //will get the first node of results
$node->find('a',1); //will get the second node of results
$allA = $node->find('ul>li',true)->find('a');
$node->find('ul>li',true)->remove();
foreach($node->children('img') as $img){
if(!$img->alt)
$img->alt = basename($img->src);
}
$node->children('a',0); //will get the first node of 'a' children
$node->children('a',1); //will get the second node of 'a' children
$childrenA = $node->children('ul>li',true)->children('a');
$node->children('ul>li',true)->remove();
html
<ul cacheSync="tracks">
<foreach "$model->getTracks() as $k=>$v">
<li><?=$k
html
<ul cacheStatic>
<foreach "$model->getTracks() as $k=>$v">
<li><?=$k
html
<extend>
<after main>
<img src="img/signature.png">
</after>
<after "main>article:nth-child(2)">
<article>Bla bla bla ...</article>
</after>
</extend>
html
<extend>
<append main>
<img src="img/signature.png">
</append>
<append "body>main">
<article>Bla bla bla ...</article>
</append>
</extend>
html
<after selector="input[name][type!=checkbox][type!=hidden], select[name], textarea[name]">
<?
if(isset($formErrors)&&isset($formErrors["{{compile:
rtrim(str\_replace(array('[',']'),array('.',''),'{{this:name}}'),'.')
}}"])){
html
<extend>
<before main>
<img src="img/signature.png">
</before>
<before "main>article:nth-child(2)">
<article>Bla bla bla ...</article>
</before>
</extend>
html
<if "$cond" />
<end>
<switch "$switcher" />
<end>
<foreach "$var as $v" />
<end>
html
<?$insideVar = true;
html
<extend>
<main>
<h1>Hi</h1>
</main>
</extend>