\Nano4\ControllersResources

Adds Resource Management for CSS, Stylesheets, etc.

Has built-in support for the Nano.js project.

Summary

Methods
Properties
Constants
find_resource()
use_resource()
add_js()
add_css()
No public properties found
No constants found
No protected methods found
$resources
N/A
No private methods found
No private properties found
N/A

Properties

$resources

$resources : 

Resources represent external files, such as scripts, stylesheets, etc.

They are managed through a generic system that allows for easy future expansion.

Each group as a resource id, such as 'js', 'css', etc, and the following definitions:

name: The variable name for templates. path: An array of paths to look for resource files in. exts: An array of extensions to look for resource files. groups: An array of arrays, each being named groups. It is recommended to prefix groups with an identifier such as '#'. We include '#common' and '#webapp' as example groups, they depend upon the Nano.js library set. added: An empty array, will be populated by use_resource();

A group for one resource type MAY in fact depend on a resource of another type. For instance, you may have a Javascript file that depends on a CSS stylesheet being loaded. You can define a rule that will include it, by using a 'type:name' format, such as 'css:foobar'.

Type

Methods

find_resource()

find_resource(String  $type, String  $name) 

Find a resource file, based on known paths and extensions.

Parameters

String $type

The resource type.

String $name

The resource name without path or extension.

use_resource()

use_resource(String  $type, String  $name) 

Add a resource file to an array of resources for use in view templates.

Parameters

String $type

The resource type.

String $name

The resource or group name.

add_js()

add_js(  $name) 

Add a Javascript file or group to our used resources.

Parameters

$name

add_css()

add_css(  $name) 

Add a CSS stylesheet file or group to our used resources.

Parameters

$name