TwistPHP Documentation

viewCSS

File path: dist/twist/Core/Models/Resources.model.php
Namespace: Twist\Core\Models
Extends:

viewCSSOutputs a CSS resource to the HTML using the view tag {css:}. The option to load the resources inline or asynchronously can be used.
The first part of the tag is the resource path e.g 'packages/Lavish/Resources/css/base.css', the tag for this would be {css:packages/Lavish/Resources/css/base.css}.
You can override CSS files that are located in twist or an installed package by placing a copy of the file and path in your apps folder. The override file would be included in the page rather than the original file, the example override file would need ot be created here [app/packages/Lavish/Resources/css/base.css].
Other parameters can be included in the tag, you can use a single or combination of parameters (some examples below):
inline = 1
Output the resource directly to the page, this will stop any additional js/css files being loaded into the page.
async = async|defer
Define the type of asynchronously loading, the choice of async or defer can be optionally set.
An example of the tag with all the above parameters in use {css:packages/Lavish/Resources/css/base.css,inline=1,async=async}

Parameters

Name Type Description
$strReferencestringn/a
[$arrParameters = array()]arrayn/a

Return Values

void — No return information has been documented for this function.

Example

<?php
//Set the variables for the example
$strReference 'foo';
$arrParameters = array();

//Call the function viewCSS with the example vars
$resResources = new \Twist\Core\Models\Resources();
$resResources -> viewCSS($strReference$arrParameters);