phile / template-lex
该软件包已被废弃且不再维护。没有推荐替代软件包。
在PhileCMS模板中使用Lex解析器
dev-master
2018-03-24 13:52 UTC
Requires
- phile-cms/phile: >=1
- phile-cms/plugin-installer-plugin: >=1
- pyrocms/lex: 2.2.*
This package is not auto-updated.
Last update: 2020-01-24 15:29:07 UTC
README
注意:此存储库不再维护并已存档。
phileTemplateLex
1.1 安装(composer)
php composer.phar require phile/template-lex:*
1.2 安装(下载)
- 安装Phile的最新版本
- 将此存储库克隆到
plugins/phile/templateLex
2. 激活
在安装插件后,您需要将以下行添加到您的config.php
文件中
$config['plugins']['phile\\templateLex'] = array('active' => true);
通过composer安装Lex
只需将Lex依赖项添加到您的composer.json文件中
{ "require": { "twig/twig": "1.14.*", "michelf/php-markdown": "1.3", "pyrocms/lex": "2.2.*" // this is the new line you will need } }
现在,像往常一样运行您的composer install
命令。
修改您的config.php
文件
$config['plugins'] = array( // disable the Twig template engine 'phile\\templateTwig' => array('active' => false), // enable the Lex template engine 'phile\\templateLex' => array('active' => true) );
免责声明
由于Phile中页面模型的性质以及Lex不喜欢某些对象,因此对pages
数组有一些不同的属性可用。
- 标题
- URL
- 内容
- 元数据
这涵盖了在Twig中pages
数组覆盖的大部分内容。
不是Twig的即插即用替代品
如果您以前没有使用过Lex,请阅读文档,因为Lex与Twig在语法和哲学上存在一些差异。
我包括了一个index.lex
文件,以显示如何从默认主题重新创建索引页面。
为什么使用这个而不是Twig
- 不同的语法(全部花括号,没有{% %}花括号)
- 更轻量级(但这是有争议的)
- 比Twig或Smarty简单得多(功能更少)