TwistPHP Documentation

viewResource

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

viewResourceOutputs framework resources in a view, multiple versions of a resource might be available to use. The option to load the resources inline or asynchronously can be used. Additional resources can be added to the library by packages or by following the online examples.
Each unique resource request will only be output once per page to stop unnecessary content duplication. The first part of the tag is the resource key e.g 'jquery', if you want to include the default version use the following tag {resource:jquery}.
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.
version = 2.0.0
The version of the resource that will be loaded, check the recourse library in the docs to find out what versions are available.
An example of the tag with all the above parameters in use {resource:jquery,inline=1,async=async,version=2.0.0}

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 viewResource with the example vars
$resResources = new \Twist\Core\Models\Resources();
$resResources -> viewResource($strReference$arrParameters);