mvcViewJavascript

Represents an additional javascript resource to be used in the view for rendering. This allows for external libraries to be loaded and rendered more easily. Generates a valid XHTML script or script src link.

// add a separate JS file
$oJs = new mvcViewJavascript('myjs', mvcViewJavascript::TYPE_FILE, '/path/to/file.js');

// add some inline JS
$oJs = new mvcViewJavascript('myjs', mvcViewJavascript::TYPE_INLINE, 'var = document.getElementById();');

// add some js specifically with a different type
$oJs = new mvcViewJavascript(
    'myjson', mvcViewJavascript::TYPE_INLINE, '{ data: { property: 'value' } }', 'application/json'
);

Methods

public __construct([$inIdentifier = null], [$inType = 'file'], [$inResource = ''], [$inMimeType = 'text/javascript'])

Creates a new Javascript object

public __toString()

Converts the object to a string

public reset()

Resets the object


Inherited Methods

<  1  >