|
| $template = "" |
|
| $viewData = [] |
|
|
| $layout = null |
|
| $subViews = [] |
|
| $config = null |
|
| $loader = null |
|
| $response = null |
|
SlaxWeb\View\Base::__construct |
( |
Config |
$config, |
|
|
Loader |
$loader, |
|
|
Response |
$response |
|
) |
| |
Class constructor
Instantiate the view, by assigning its dependencies to the class properties. Set the base directory for the template files, and set the template name if none is already set by an override property and config permits it.
- Parameters
-
\SlaxWeb\Config\Container | $config | Configuration container |
\SlaxWeb\View\AbstractLoader | $loader | Template file loader |
\Symfony\Component\HttpFoundation\Response | $response | Response object |
SlaxWeb\View\Base::addSubTemplate |
( |
string |
$name, |
|
|
string |
$subTemplate |
|
) |
| |
Add SubTemplate
Adds a SubTemplate to the local container. The '$name' parameter is the name under which the rendered subview is then available in the main view. Example: When '$name' is 'foo', the variable in the template will be 'subview_foo'. The SubTemplate is the same as a SubView except it does not provide its own View Class, but is simply rendered using the current instance.
- Parameters
-
string | $name | Name of the SubView |
string | $subTemplate | Sub Template name |
- Returns
- self
SlaxWeb\View\Base::addSubView |
( |
string |
$name, |
|
|
Base |
$subView |
|
) |
| |
Add SubView
Adds a SubView to the local container. The '$name' parameter is the name under which the rendered subview is then available in the main view. Example: When '$name' is 'foo', the variable in the template will be 'subview_foo'.
- Parameters
-
string | $name | Name of the SubView |
\SlaxWeb\View\Base | $subView | Sub View object extended from the same Base class |
- Returns
- self
SlaxWeb\View\Base::render |
( |
array |
$data = [] , |
|
|
int |
$return = Loader::TPL_OUTPUT , |
|
|
int |
$cacheData = Loader::TPL_CACHE_VARS |
|
) |
| |
Render view
Renders the view by rendering the template with the provided template loader.
- Parameters
-
array | $data | Template data to be passed to the template. Default [] |
int | $return | Output or return rendered template. Default self::TPL_OUTPUT |
int | $cacheData | Cache template data. Default self::TPL_CACHE_VARS |
- Returns
- mixed
SlaxWeb\View\Base::renderSubViews |
( |
| ) |
|
|
protected |
Render SubViews
Render the SubViews and add rendered results to the View Data array.
- Returns
- void
SlaxWeb\View\Base::setLayout |
( |
Base |
$layout = null | ) |
|
Set Layout
Sets the received View class as layout if it is supplied. If no parameter is set, then the layout will not be used.
- Parameters
-
\SlaxWeb\View\Base | $layout | Layout view class |
- Returns
- self
The documentation for this class was generated from the following file:
- /opt/slax0rDev/slaxweb/view/src/Base.php