CClientScript

NameclientScript
ClassCClientScript
Location/home/vhosts/app-manager.eu5.org/framework/web/CClientScript.php
CClientScript manages JavaScript and CSS stylesheets for views.

Options

Displaying 1-10 of 10 results.
NameValueDescriptionType
enableJavaScripttrueWhether JavaScript should be enabled. Defaults to true.boolean
scriptMaparray()The mapping between script file names and the corresponding script URLs. The array keys are script file names (without directory part) and the array values are the corresponding URLs. If an array value is false, the corresponding script file will not be rendered. If an array key is '*.js' or '*.css', the corresponding URL will replace all JavaScript files or CSS files, respectively. This property is mainly used to optimize the generated HTML pages by merging different scripts files into fewer and optimized script files.array
packagesarray()List of custom script packages (name=>package spec). This property keeps a list of named script packages, each of which can contain a set of CSS and/or JavaScript script files, and their dependent package names. By calling {@link registerPackage}, one can register a whole package of client scripts together with their dependent packages and render them in the HTML output. The array structure is as follows: <pre> array( 'package-name'=>array( 'basePath'=>'alias of the directory containing the script files', 'baseUrl'=>'base URL for the script files', 'js'=>array(list of js files relative to basePath/baseUrl), 'css'=>array(list of css files relative to basePath/baseUrl), 'depends'=>array(list of dependent packages), ), ...... ) </pre> The JS and CSS files listed are relative to 'basePath'. For example, if 'basePath' is 'application.assets', a script named 'comments.js' will refer to the file 'protected/assets/comments.js'. When a script is being rendered in HTML, it will be prefixed with 'baseUrl'. For example, if 'baseUrl' is '/assets', the 'comments.js' script will be rendered using URL '/assets/comments.js'. If 'baseUrl' does not start with '/', the relative URL of the application entry script will be inserted at the beginning. For example, if 'baseUrl' is 'assets' and the current application runs with the URL 'http://localhost/demo/index.php', then the 'comments.js' script will be rendered using URL '/demo/assets/comments.js'. If 'baseUrl' is not set, the script will be published by {@link CAssetManager} and the corresponding published URL will be used. When calling {@link registerPackage} to register a script package, this property will be checked first followed by {@link corePackages}. If a package is found, it will be registered for rendering later on. @since 1.1.7array
corePackagesnullList of core script packages (name=>package spec). Please refer to {@link packages} for details about package spec. By default, the core script packages are specified in 'framework/web/js/packages.php'. You may configure this property to customize the core script packages. When calling {@link registerPackage} to register a script package, {@link packages} will be checked first followed by this property. If a package is found, it will be registered for rendering later on. @since 1.1.7array
scriptsarray()The registered JavaScript code blocks (position, key => code)array
coreScriptPosition0Where the scripts registered using {@link registerCoreScript} or {@link registerPackage} will be inserted in the page. This can be one of the CClientScript::POS_* constants. Defaults to CClientScript::POS_HEAD. @since 1.1.3integer
defaultScriptFilePosition0Where the scripts registered using {@link registerScriptFile} will be inserted in the page. This can be one of the CClientScript::POS_* constants. Defaults to CClientScript::POS_HEAD. @since 1.1.11integer
defaultScriptPosition4Where the scripts registered using {@link registerScript} will be inserted in the page. This can be one of the CClientScript::POS_* constants. Defaults to CClientScript::POS_READY. @since 1.1.11integer
behaviorsarray()The behaviors that should be attached to this component. The behaviors will be attached to the component when {@link init} is called. Please refer to {@link CModel::behaviors} on how to specify the value of this property.array
coreScriptUrlnullSets the base URL of all core javascript files. This setter is provided in case when core javascript files are manually published to a pre-specified location. This may save asset publishing time for large-scale applications. the base URL of all core javascript files.string
Free Web Hosting