Base
in package
Base view class for the Neuron MVC framework.
This abstract base class provides common functionality for all view types in the MVC framework, including layout management, controller/page tracking, and caching configuration. It serves as the foundation for specific view implementations like HTML, JSON, XML, and Markdown views.
Key features:
- Layout template management for consistent page structure
- Controller and page identification for view resolution
- Individual view caching control (overrides global settings)
- Fluent interface for method chaining
- Foundation for multi-format view rendering
The view system supports hierarchical template resolution:
- Application-specific view directories
- Framework default view templates
- Layout wrapping with content injection
Tags
Table of Contents
Properties
- $fs : IFileSystem
- $_cacheEnabled : bool|null
- $_controller : string
- $_layout : string
- $_page : string
Methods
- __construct() : mixed
- getCacheEnabled() : bool|null
- Get cache enabled setting for this view instance
- getController() : string
- getLayout() : string
- getPage() : string
- setCacheEnabled() : Base
- Set cache enabled setting for this view instance
- setController() : Html
- setLayout() : Html
- setPage() : Html
Properties
$fs
protected
IFileSystem
$fs
$_cacheEnabled
private
bool|null
$_cacheEnabled
= null
$_controller
private
string
$_controller
$_layout
private
string
$_layout
$_page
private
string
$_page
Methods
__construct()
public
__construct([IFileSystem|null $fs = null ]) : mixed
Parameters
- $fs : IFileSystem|null = null
getCacheEnabled()
Get cache enabled setting for this view instance
public
getCacheEnabled() : bool|null
Return values
bool|null —null means use global config, true/false overrides global
getController()
public
getController() : string
Return values
stringgetLayout()
public
getLayout() : string
Return values
stringgetPage()
public
getPage() : string
Return values
stringsetCacheEnabled()
Set cache enabled setting for this view instance
public
setCacheEnabled(bool|null $cacheEnabled) : Base
Parameters
- $cacheEnabled : bool|null
-
null uses global config, true/false overrides
Return values
BasesetController()
public
setController(string $controller) : Html
Parameters
- $controller : string
Return values
HtmlsetLayout()
public
setLayout(string $layout) : Html
Parameters
- $layout : string
Return values
HtmlsetPage()
public
setPage(string $page) : Html
Parameters
- $page : string