PMVC官方视图引擎

0.5.6 2022-04-12 13:19 UTC

This package is auto-updated.

Last update: 2024-09-12 18:25:29 UTC


README

Latest Stable Version Latest Unstable Version CircleCI License Total Downloads

PMVC视图模板

解释模板变量

    1. 初始化
    • 应用程序通过逻辑将参数分配给模板变量
    1. 处理视图之前
    • 如果插件view_config_helper。(为什么需要使用view_config_helper)
        1. 加载全局选项'VIEW'。
        1. 将全局选项'I18N'与VIEW['I18N']合并
        1. 从.env.view获取配置并将其合并到配置中,当您需要开发和覆盖远程配置时很有用。
        1. 如果有view_config_helper回调,将通过回调处理$config。
        1. 将所有以上配置设置为模板变量。
    1. 运行视图处理过程
    • 视图引擎将特定tpl配置复制到插件配置
    • 特定的键如'assetsRoot'将从模板变量复制到插件配置,如果我们有变量需要从view_config_helper覆盖插件配置。

解释主题配置

配置位置 : [SiteFolder]/themes/[ThemeName]/config/config.php

${_INIT_CONFIG}=[
  'backend' => [], // will append with view plugin and use in backend.
  'view' => [], // will append to front-end view variable, and could see it in browser (JS) level.
  'compile' => [], // use webpack compile only
];

如何处理输出头?

https://github.com/pmvc-plugin/view/wiki#how-to-config-header

传递模板文件夹

目的

可分享的前进

使用Composer安装

1. 下载Composer

2. 编辑composer文件

  • vim composer.json
{
    "require": {
        "pmvc-plugin/view": "dev-master"
    }
}