PMVC official view engine

0.5.6 2022-04-12 13:19 UTC

This package is auto-updated.

Last update: 2024-04-12 17:44:12 UTC


README

Latest Stable Version Latest Unstable Version CircleCI License Total Downloads

PMVC View template

Explain Template variable

    1. Initiate
    • App assign params to template variable by logic
    1. Before process view
    • If plug view_config_helper. (Why need use view_config_helper)
        1. Load global option 'VIEW'.
        1. Merge global option 'I18N' with VIEW['I18N']
        1. Get configs from .env.view and merge to configs, it's useful when you need develop and overwrite remote configs.
        1. If have view_config_helper callback will cook $config by callback
        1. Set all above configs to template variable.
    1. Running view process
    • View engine will extra specific tpl config to plugin config
    • Specific keys such as 'assetsRoot' will copy from template variable to plugin config, if we have variabe need overwirte plugin config from view_config_helper.

Explain theme config

Config location : [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
];

How to handle output header?

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

Pass Template Folder

Purpose

Shareable forward

Install with Composer

1. Download composer

2. Edit composer file

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