Chargement...
 
Skip to main content

  $headerlib = TikiLib::lib('header');  

* Add Javascript and CSS to output

  • Javascript and CSS can be added:

* - as files (filename including relative path to tiki root)

* - as scripts (string)

* - as a url to load from a cdn (Note: use $tikilib->httpScheme() to build the url. It considers reverse proxies and returns correctly 'http' or 'https')

* Note: there are 2 prefs to add additional cdns. one for http and one for https.

*

* To maintain the order of loading Javascript and to allow minifying, the following "ranks" are supported:

* '10dynamic': loaded first to allow minification of the other ranks. Usually module and plugin descriptions.

* '20cdn' : loaded after 'dynamic', no minification possible // main libs like jquery from jquery/google cdn (no user cdns)

* '30dependency': loaded after 'cdn', minification possible // main libs like jquery, codemirror

* '40external': loaded after 'dependency', minification possible // custom libs that require main libs

* '50standard': loaded after 'external', minification possible // standard js that might require main / custom libs

* '60late': loaded after 'standard', minification possible // page specific js

* Note: this rank is activated in tiki-setup.php to separate page specific JS from common JS

* So any JS loaded after tiki-setup.php that has no rank 'external' is put into 'late'.

* If minification is activated for late, any new combination of late files will be created automatically if needed.

* When using user specific CDNs AND minification for late is enabled, any possible minified file must be available via that CDN!

*

* The order of files within each section will be maintained. What adds first will be processed first.

*

* Note: cdns (google/jquery, not user cdns), files and scripts (strings) will be handled separately.

 

* To add JS, the following methods are available.

* Methods to add JS files:

* If $skip_minify == true, the file will not be processed for further minification.

* This could be used to avoid screwing up the JS file in the rare case minification on that particular file does not work.

* It will however be concatenated to a single JS file.

* add_jsfile_cdn($url) - add a JS File from a CDN

* add_jsfile_dependency($filename, $skip_minify) - add a JS File to the section dependency

* add_jsfile_external($filename, $skip_minify) - add a JS File to the section external

* add_jsfile($filename, $skip_minify) - add a JS File to the section standard

* add_jsfile_late($filename, $skip_minify) - add a JS File to the section late

* These functions allow to add JS as scripts/strings. No minification on them:

* add_js($script, $rank) - add JS as string

* add_jq_onready($script, $rank) - add JS as string and add to the onready event

* add_js_config($script, $rank) - add JS that usually represents a config object

*

$smarty = TikiLib::lib('smarty');