pmvc-plugin / view
PMVC official view engine
Installs: 3 115
Dependents: 8
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- pmvc/pmvc: *
Requires (Dev)
README
PMVC View template
Explain Template variable
-
- Initiate
- App assign params to template variable by logic
-
- Before process view
- If plug view_config_helper. (Why need use view_config_helper)
-
- Load global option 'VIEW'.
-
- Merge global option 'I18N' with VIEW['I18N']
-
- Get configs from .env.view and merge to configs, it's useful when you need develop and overwrite remote configs.
-
- If have view_config_helper callback will cook $config by callback
-
- Set all above configs to template variable.
-
-
- 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
- user pmvc config _TEMPLATE_DIR
- https://github.com/pmvc-plugin/controller/blob/master/src/Constants.php#L48
Purpose
- Use __invoke to get other framework object instance
Shareable forward
Install with Composer
1. Download composer
- mkdir test_folder
- curl -sS https://getcomposer.org/installer | php
2. Edit composer file
- vim composer.json
{
"require": {
"pmvc-plugin/view": "dev-master"
}
}