2017 © Pedro Peláez
 

library view

PMVC official view engine

image

pmvc-plugin/view

PMVC official view engine

  • Saturday, September 16, 2017
  • by HillLiu
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2,374 Installations
  • PHP
  • 8 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 3 % Grown

The README.md

Latest Stable Version Latest Unstable Version CircleCI License Total Downloads, (*1)

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 * Example: https://github.com/pmvc-theme/hello_react/blob/master/config/config.php, (*2)

${_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/blob/master/src/ViewEngine.php#L154-L155

How to handle output header?

https://github.com/pmvc-plugin/view/wiki#how-to-config-header, (*3)

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
    • https://github.com/pmvc-plugin/view/blob/master/src/ViewEngine.php#L29-L32

Shareable forward

  • https://github.com/pmvc-plugin/default_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"
    }
}

The Versions

16/09 2017

dev-master

9999999-dev https://github.com/pmvc-plugin/view

PMVC official view engine

  Sources   Download

MIT

The Requires

 

by Hill

view plug-in pmvc

16/09 2017

0.3.26

0.3.26.0 https://github.com/pmvc-plugin/view

PMVC official view engine

  Sources   Download

MIT

The Requires

 

by Hill

view plug-in pmvc

10/07 2017

0.3.25

0.3.25.0 https://github.com/pmvc-plugin/view

PMVC official view engine

  Sources   Download

MIT

The Requires

 

by Hill

view plug-in pmvc

12/04 2017

0.3.20

0.3.20.0 https://github.com/pmvc-plugin/view

PMVC official view engine

  Sources   Download

MIT

The Requires

 

by Hill

view plug-in pmvc

10/02 2017

0.3.19

0.3.19.0 https://github.com/pmvc-plugin/view

PMVC official view engine

  Sources   Download

MIT

The Requires

 

by Hill

view plug-in pmvc