HtmlRendering
extends Rendering
in package
The HTML rendering class
A basic class to render HTML using PHP scripts.
Table of Contents
Constants
- LINK_TYPE_CUSTOM = 2
- LINK_TYPE_PLUGIN = 1
Properties
- $cssPath : string
- Path to css folder
- $cssURLs : array<string|int, mixed>
- List of CSS Urls to load
- $defaultTheme : string|null
- The default theme to use for $theme
- $jsPath : string
- Path to js folder
- $jsURLs : array<string|int, mixed>
- List of JS Urls to load
- $layoutsPath : string
- Path to layouts folder
- $metaprop : array<string|int, mixed>
- List of meta-properties to send
- $remote : bool
- $renderingId : int
- $resourcePath : string
- $themeFolderUri : string
- $current : Rendering
- The current global rendering
- $layoutStack : array<string|int, mixed>
- The rendering layout stack
- $menusConfig : Config
- The configuration of the menu
- $renderingStack : array<string|int, mixed>
- The current rendering stack
- $theme : string
- The theme to use to render HTML layouts
Methods
- __construct() : mixed
- addCssFile() : mixed
- Add a global css file to the list
- addCssUrl() : mixed
- Add a css url to the list
- addJsFile() : HtmlRendering
- Add a global js file to the list
- addJsUrl() : HtmlRendering
- Add a js url to the list
- addMetaProperty() : void
- Add a html meta property to the list
- addThemeCssFile() : mixed
- Add a theme css file to the list
- addThemeJsFile() : HtmlRendering
- Add a theme js file to the list
- captureOutput() : void
- Start capture of buffer
- display() : void
- Display the model, allow an absolute path to the template file.
- endCapture() : bool|string
- End capture of buffer
- endCurrentLayout() : bool
- End the current layout
- existsLayoutPath() : bool
- Test if the layout exists
- getAbsThemePath() : string
- Get the absolute theme path.
- getCssPath() : string
- Get the css theme path
- getCssUrl() : string
- Get the CSS files url
- getCurrent() : static
- getDefaultTheme() : string
- Get the default theme used to render layouts
- getJsPath() : string
- Get the js theme path
- getJsUrl() : string
- Get the JS files url
- getLayoutPath() : string
- Get the path to the $layout
- getLayoutsPath() : string
- Get the layout theme path
- getMenuItems() : array<string|int, string>
- Get menu items
- getRenderingId() : int
- getResourcePath() : string
- getThemeFolderUri() : string
- Get Theme folder Url. Mainly, a http URL for a website.
- getThemePath() : string
- Get the theme path.
- getThemeUrl() : string
- Get the theme url
- isRemote() : bool
- listCssUrls() : array<string|int, mixed>
- List all registered css URLs
- listJsUrls() : array<string|int, mixed>
- List all registered js URLs
- listMetaProperties() : array<string|int, mixed>
- List all registered html meta properties
- render() : string|null
- Render the model This function does not display the result, see display().
- setDefaultTheme() : mixed
- Set the default theme used to render layouts
- setRemote() : self
- setResourcePath() : HtmlRendering
- setTheme() : mixed
- Set the theme used to render layouts
- setThemeFolderUri() : self
- showMenu() : void
- Show the $menu
- startNewBlock() : void
- Start new block capture
- useLayout() : void
- Use layout until the next endCurrentLayout()
- addTypedUrl() : mixed
- Add an $url by $type in $array
- getCurrentRendering() : array<string|int, mixed>|null
- Get current rendering
- listTypedUrl() : array<string|int, mixed>
- List urls by $type in $array
- pullFromStack() : void
- Remove current rendering and get to previous one
- pushToStack() : void
- Push rendering to stack
Constants
LINK_TYPE_CUSTOM
public
int
LINK_TYPE_CUSTOM
= 2
LINK_TYPE_PLUGIN
public
int
LINK_TYPE_PLUGIN
= 1
Properties
$cssPath
Path to css folder
public
string
$cssPath
= '/css'
$cssURLs
List of CSS Urls to load
public
array<string|int, mixed>
$cssURLs
= []
$defaultTheme
The default theme to use for $theme
public
static string|null
$defaultTheme
= null
$jsPath
Path to js folder
public
string
$jsPath
= '/js'
$jsURLs
List of JS Urls to load
public
array<string|int, mixed>
$jsURLs
= []
$layoutsPath
Path to layouts folder
public
string
$layoutsPath
= '/layouts'
$metaprop
List of meta-properties to send
public
array<string|int, mixed>
$metaprop
= []
$remote
public
bool
$remote
= true
$renderingId
public
int
$renderingId
= 0
$resourcePath
public
string
$resourcePath
= null
$themeFolderUri
public
string
$themeFolderUri
= null
$current
The current global rendering
protected
static Rendering
$current
$layoutStack
The rendering layout stack
protected
static array<string|int, mixed>
$layoutStack
= []
$menusConfig
The configuration of the menu
protected
static Config
$menusConfig
$renderingStack
The current rendering stack
protected
array<string|int, mixed>
$renderingStack
= []
$theme
The theme to use to render HTML layouts
protected
string
$theme
Methods
__construct()
public
__construct() : mixed
addCssFile()
Add a global css file to the list
public
addCssFile(string $filename[, string $type = null ]) : mixed
Parameters
- $filename : string
- $type : string = null
addCssUrl()
Add a css url to the list
public
addCssUrl(string $url[, string $type = null ]) : mixed
Parameters
- $url : string
- $type : string = null
addJsFile()
Add a global js file to the list
public
addJsFile(string $filename[, string|null $type = null ]) : HtmlRendering
Parameters
- $filename : string
- $type : string|null = null
Return values
HtmlRenderingaddJsUrl()
Add a js url to the list
public
addJsUrl(string $url[, string $type = null ]) : HtmlRendering
Parameters
- $url : string
- $type : string = null
Return values
HtmlRenderingaddMetaProperty()
Add a html meta property to the list
public
addMetaProperty(string $property, string $content) : void
Parameters
- $property : string
- $content : string
addThemeCssFile()
Add a theme css file to the list
public
addThemeCssFile(string $filename[, string $type = null ]) : mixed
Parameters
- $filename : string
- $type : string = null
addThemeJsFile()
Add a theme js file to the list
public
addThemeJsFile(string $filename[, string|null $type = null ]) : HtmlRendering
Parameters
- $filename : string
- $type : string|null = null
Return values
HtmlRenderingcaptureOutput()
Start capture of buffer
public
static captureOutput() : void
display()
Display the model, allow an absolute path to the template file.
public
display([string|null $layout = null ][, array<string|int, mixed> $env = [] ]) : void
Parameters
- $layout : string|null = null
-
The model to use
- $env : array<string|int, mixed> = []
-
An environment variable
endCapture()
End capture of buffer
public
static endCapture() : bool|string
Return values
bool|stringendCurrentLayout()
End the current layout
public
endCurrentLayout([array<string|int, mixed> $env = [] ]) : bool
Parameters
- $env : array<string|int, mixed> = []
-
The environment to render the layout
Return values
bool —False if there is no current layout
existsLayoutPath()
Test if the layout exists
public
existsLayoutPath(string $layout) : bool
Parameters
- $layout : string
Return values
boolgetAbsThemePath()
Get the absolute theme path.
public
getAbsThemePath() : string
Tags
Return values
string —The theme path.
Get the absolute path to the current theme.
getCssPath()
Get the css theme path
public
getCssPath() : string
Return values
string —The css theme path
getCssUrl()
Get the CSS files url
public
getCssUrl() : string
Return values
string —The CSS url
getCurrent()
public
static getCurrent() : static
Return values
staticgetDefaultTheme()
Get the default theme used to render layouts
public
static getDefaultTheme() : string
Return values
string —$theme
getJsPath()
Get the js theme path
public
getJsPath() : string
Return values
string —The JS theme path
getJsUrl()
Get the JS files url
public
getJsUrl() : string
Return values
string —The JS url
getLayoutPath()
Get the path to the $layout
public
getLayoutPath(string $layout) : string
Parameters
- $layout : string
Return values
stringgetLayoutsPath()
Get the layout theme path
public
getLayoutsPath() : string
Return values
string —The models theme path
getMenuItems()
Get menu items
public
getMenuItems(string $menu) : array<string|int, string>
Parameters
- $menu : string
-
The menu to get items
Return values
array<string|int, string> —The menu items
getRenderingId()
public
getRenderingId() : int
Return values
intgetResourcePath()
public
getResourcePath() : string
Return values
stringgetThemeFolderUri()
Get Theme folder Url. Mainly, a http URL for a website.
public
getThemeFolderUri() : string
Return values
stringgetThemePath()
Get the theme path.
public
getThemePath() : string
Return values
string —The theme path
Get the path to the current theme.
getThemeUrl()
Get the theme url
public
getThemeUrl() : string
Return values
stringisRemote()
public
isRemote() : bool
Return values
boollistCssUrls()
List all registered css URLs
public
listCssUrls([string $type = null ]) : array<string|int, mixed>
Parameters
- $type : string = null
Return values
array<string|int, mixed>listJsUrls()
List all registered js URLs
public
listJsUrls([string $type = null ]) : array<string|int, mixed>
Parameters
- $type : string = null
Return values
array<string|int, mixed>listMetaProperties()
List all registered html meta properties
public
listMetaProperties() : array<string|int, mixed>
Return values
array<string|int, mixed>render()
Render the model This function does not display the result, see display().
public
render([null $layout = null ][, array<string|int, mixed> $env = [] ]) : string|null
Parameters
- $layout : null = null
-
The model to use, default use is defined by child
- $env : array<string|int, mixed> = []
-
An environment variable, commonly an array but depends on the rendering class used
Tags
Return values
string|nullsetDefaultTheme()
Set the default theme used to render layouts
public
static setDefaultTheme(string $theme) : mixed
Parameters
- $theme : string
setRemote()
public
setRemote(bool $remote) : self
Parameters
- $remote : bool
Return values
selfsetResourcePath()
public
setResourcePath(string $resourcePath) : HtmlRendering
Parameters
- $resourcePath : string
Return values
HtmlRenderingsetTheme()
Set the theme used to render layouts
public
setTheme(string $theme) : mixed
Parameters
- $theme : string
setThemeFolderUri()
public
setThemeFolderUri(string $themeFolderUri) : self
Parameters
- $themeFolderUri : string
Return values
selfshowMenu()
Show the $menu
public
showMenu(string $menu[, string|null $layout = null ][, string|null $activeLink = null ]) : void
Parameters
- $menu : string
-
The menu name
- $layout : string|null = null
-
the layout to use
- $activeLink : string|null = null
-
Active item link
Tags
startNewBlock()
Start new block capture
public
startNewBlock(string $name) : void
Parameters
- $name : string
useLayout()
Use layout until the next endCurrentLayout()
public
useLayout(string $layout[, string $block = 'content' ]) : void
Parameters
- $layout : string
-
The layout to use.
- $block : string = 'content'
Tags
addTypedUrl()
Add an $url by $type in $array
protected
static addTypedUrl(array<string|int, mixed> &$array, string $url[, string|null $type = null ]) : mixed
Parameters
- $array : array<string|int, mixed>
- $url : string
- $type : string|null = null
getCurrentRendering()
Get current rendering
protected
getCurrentRendering() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —array($layout, $env);
listTypedUrl()
List urls by $type in $array
protected
static listTypedUrl(array<string|int, mixed> &$array[, string|null $type = null ]) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
- $type : string|null = null
Return values
array<string|int, mixed>pullFromStack()
Remove current rendering and get to previous one
protected
pullFromStack() : void
pushToStack()
Push rendering to stack
protected
pushToStack(string $layout, array<string|int, mixed> $env) : void
Parameters
- $layout : string
- $env : array<string|int, mixed>