Comments: on this page. Click to read or post your own.
Requirements tracker, for javascript and css.
Located in /sapphire/core/Requirements.php (line 8)
The filepaths (relative to webroot) or uniquenessIDs of any included requirements which should be blocked when executing inlcudeInHTML().
This is useful to e.g. prevent core classes to modifying Requirements without subclassing the entire functionality. Use unblock() or unblock_all() to revert changes.
See combine_files().
Using the JSMin library to minify any javascript file passed to combine_files().
Paths to all required .css files relative to the webroot.
All custom CSS rules which are inserted directly at the bottom of the HTML <head> tag.
All custom HTML markup which is added before the closing <head> tag, e.g. additional metatags.
This is preferred to entering tags directly into
All custom javascript code that is inserted directly at the bottom of the HTML <head> tag.
Remembers the filepaths of all cleared Requirements through clear().
Paths to all required .js files relative to the webroot.
Put all javascript includes at the bottom of the template before the closing <body> tag instead of the <head> tag.
This means script downloads won't block other HTTP-requests, which can be a performance improvement. Caution: Doesn't work when modifying the DOM from those external scripts without listening to window.onload/document.ready (e.g. toplevel document.write() calls).
Needed to actively prevent the inclusion of a file, e.g. when using your own prototype.js.
Blocking should only be used as an exception, because it is hard to trace back. You can just block items with an ID, so make sure you add an unique identifier to customCSS() and customScript().
Clear either a single or all requirements.
Caution: Clearing single rules works only with customCSS and customScript if you specified a {@uniquenessID}.
Re-sets the combined files definition
Concatenate several css or javascript files into a single dynamically generated file (stored in Director::baseFolder()). This increases performance by fewer HTTP requests.
The combined file is regenerated based on every file modification time. Optionally a rebuild can be triggered by appending ?flush=1 to the URL. If all files to be combined are javascript, we use the external JSMin library to minify the javascript. This can be controlled by $combine_js_with_jsmin.
All combined files will have a comment on the start of each concatenated file denoting their original position. For easier debugging, we recommend to only minify javascript if not in development mode (Director::isDev()).
CAUTION: You're responsible for ensuring that the load order for combined files is retained - otherwise combining javascript files can lead to functional errors in the javascript logic, and combining css can lead to wrong styling inheritance. Depending on the javascript logic, you also have to ensure that files are not included in more than one combine_files() call. Best practice is to include every javascript file in exactly *one* combine_files() directive to avoid the issues mentioned above - this is enforced by this function.
CAUTION: Combining CSS Files discards any "media" information.
Example for combined JavaScript:
Example for combined CSS:
Register the given stylesheet file as required.
Add the CSS styling to the header of the page
Add the javascript code to the header of the page
Deletes all dynamically generated combined files from the filesystem.
Update the given HTML content with the appropriate include tags for the registered requirements. Needs to receive a valid HTML/XHTML template in the $content parameter, including a <head> tag. The requirements will insert before the closing <head> tag automatically.
Add the following custom code to the <head> section of the page.
Register the given javascript file as required.
Filenames should be relative to the base, eg, 'sapphire/javascript/loader.js'
Load the given javascript template with the page.
See combine_files().
Automatically includes the necessary lang-files from the module according to the locale set in i18n::$current_locale.
Assumes that a subfolder /javascript exists relative to the included javascript file, with a file named after the locale - so usually <mymodule>/javascript/lang/en_US.js.
Restore requirements cleared by call to Requirements::clear
Register the given "themeable stylesheet" as required.
Themeable stylesheets have globally unique names, just like templates and PHP files. Because of this, they can be replaced by similarly named CSS files in the theme directory.
Removes an item from the blocking-list.
CAUTION: Does not "re-add" any previously blocked elements.
Removes all items from the blocking-list.
Documentation generated on Sun, 19 Oct 2008 06:45:01 +1300 by phpDocumentor 1.3.2