Views

Views are reusable PHP files and Callables that produce string output, typically producing HTML.

There are three TYPEs of views:

  • main: When the view is loaded, associated CSS & Javascript files are loaded as well. main views have a base dir, then the view name is a relative path (without extension).
  • file: The view points to an individual PHP file. No CSS or JS is loaded automatically.
  • callable: The view points to a callable that returns a string. No CSS or JS is loaded automatically.

Example:
View dir: MyPackage/view
View name: theme/page_header
Files Loaded (within the view dir):

  • theme/page_header.php
  • theme/page_header.css
  • theme/page_header.js
  • theme/page_header/*.css
  • theme/page_header/*.js

Views for package 'server'

  • error/header (type: main), (dir: /src/view)
  • error/page (type: main), (dir: /src/view)
  • theme (type: main), (dir: /src/view)
    • /src/view/theme.css

Views for package 'site'

  • anonymous_function (type: callable)
    • Anonymous Function defined in: /test/Server/bootstrap.php on line 21
  • string_callable (type: callable)
    • Function name: Lia\Test\sample_view_function(...)
  • object_method_array (type: callable)
    • Object method: Lia\Test\SampleViewClass->sample_view_method(...)
  • file_file (type: file), (file: /test/Server/view/theme.php)
  • wrong-lia (type: main), (dir: /test/Server/view)
  • nest-res (type: main), (dir: /test/Server/view)
    • /test/Server/view/nest-res/one.css
    • /test/Server/view/nest-res/one.js
    • /test/Server/view/nest-res/two.css
    • /test/Server/view/nest-res/two.js
  • theme (type: main), (dir: /test/Server/view)