Download the PHP package zodream/template without Composer

On this page you can find all versions of the php package zodream/template. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package template

template

模板引擎

模板语法

默认语法 {}

代码块

{>}            php 语句块
{>js}             脚本语句块
{>css}            样式语句块
{>text}           文本语句块 内容原样输出

{/>}              语句块结束

{>...}            特殊语句 php语句单行

注释

<!--  -->        支持html注释,里面的内容都会被删掉
{*    *}          php注释
{// }        php注释

for 循环

{for:$a}                             
{for:$a,}                            
{for:$a,$item,>$b}                   
{for:$i = 1, $i >= 1, $i ++}         
{for:$a,$item,10}                    

结束符会自动判断

if 语句

{if:...}
{elseif:...}
{if:$a,$b}                   
{if:$a,$b,$c}                   

switch 语句

{switch:...}
{switch:$a,1}             
{case:...}
{default:}

加载文件

{@file.js}        自动识别加载css或js 文件
{css:file}      引入css文件
{js:file}         引入js文件
{tpl:file}       加载模板文件

特殊标记

{+}                  else
{-}                  endif
{forelse}            endforeach; else:
{break}              break
{continue}           continue
{break:1}            break 1
{continue:1}         continue 1
{use:...}            use ...
{url:...}            <?=$this->url(...)?>

符号标记

{| ...}              {if:...}
{+ ...}              {elseif:...}
{~ ...}              {for:...}

结束标记

{/if}               结束if
{/|}                结束if
{/switch}           结束switch
{/*}                结束switch
{/for}              结束for
{/~}                结束for

注册方法

所有的方法必须注释,否则替换为 null

{header:}          <?=$this->header()?>
{footer:}          <?=$this->footer()?>

注册方法 'a', 输出模板'b'  模板使用 {a:b,c,d,e}            会输出   <?=b(c,d,e)?>
注册方法 'a', 输出模板'<?=b(%s)?>'  模板使用 {a:b,c,d,e}            会输出   <?=b(c,d,e)?>
注册方法 'a', 输出模板''  模板使用 {a:b,c,d,e}            会输出   

给方法传值

{url:./admin?query=:$a:&v=:$b,false}       <?= $this->url('./admin?query='.$a.'&v='.$b', false) ?>
{query:1,a=>b,c=>d}              

原样输出

{#...}           输出 {...}

全局赋值

{this.a=b}       $this->a = 'b'
{.a=b}       $this->a = 'b'
{this.a=true}    $this->a = true  或 false
{this.a=$b}      $this->a = $b
{this.a='b}      $this->a = 'b'
{this.a="b"}     $this->a = "b"

批量赋值

// {$a,$b=1,2}      $a = 1 $b = 2

赋值

// {$a=$b?$c:$d}      
// {$a=$b?$d}         <php $a = $b ? $b : $d;?>
// {$a=$b||$d}        
// {$a=$b}            

输出值

{$a??$b}            <?= $a ?? $b?>
{$a}            <?= $a ?>
{$a->a}            <?= $a->a ?>
{$a.a}            <?= $a['a'] ?>
{=...}          输出 ... 执行结果

LIVE (待实现)

不允许缓存

  1. 使用方法

a.html

  1. 实现原理:

在模板解析阶段,分离live代码并合并生成一个关联文件

a.phtml

live_a.phtml

使用缓存功能时 获取 $this->section 进行字符串替换即可


All versions of template with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
zodream/zodream Version ^5.3
zodream/helpers Version ^5.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package zodream/template contains the following files

Loading the files please wait ....