Class elxisDocument provides useful tools on managing page document.
The elxisDocument library is a great tool for template and extension developers as it provides easy to use but powerful methods to master the document. Add CSS and javascript into document header, set page title and META data, load modules, display the pathway, load jQuery, load lightbox, set document type and content type are only a few of the things elxisDocument is capable to do.
To get the instance of the elxisDocument class we use eFactory getDocument method.
If you want to append css or javascript files on page's head section, or just raw javascript and css, or custom stuff, elxisDocument provides some easy to use methods. Using the built-in methods is highly recommended.
Add a link to a CSS file into the document's head section. The $url property is the full URL to the CSS file. $type is usually text/css, $media can be empty (not defined) or any of the media types HTML supports (all, screen, print, handheld, etc...). If you want to provide extra HTML attributes you can do so by providing a string value for $attribs (example: rel="alternate" charset="utf-8").
After that the test.css will be in the document's head section:
<head> <link rel="stylesheet" href="http://www.example.com/something/test.css" type="text/css" /> </head>
Add raw CSS into the document's head section. $content is a string containg the CSS declarations.
And the final HTML on the document's head section:
<head> <style type="text/css">div.test { margin:5px; }</style> </head>
Add a link to a javascript file into the document's head section. The $url property is the full URL to the js file.
Add raw javascript into the document's head section. $content is a string containing the javascript code.
Method addScriptLink can add any javascript file but especially for javascript libraries like mootools, highslide, colorbox, etc..., it is strongly recommended to use the addLibrary method as it provides some important features. The method will make sure that the link will be added only once. If different extensions load different versions of the same library Elxis will finally load only the latest one. $name is an identification name for the library (eg. mootools) and $version the library's version.
Elxis will finally append into the document's header the latest version (1.5) of the javascript library:
<head> <script type="text/javascript" src="http://www.example.com/something/mylib15.js"></script> </head>
Especially for the jQuery library, which is built-in in Elxis, use the addJQuery method to insert jQuery into page's head.
Add javascript code to be executed on document ready (uses jQuery)
Add custom head data. The contents of $content can be any string properly formatted for the document's head.
Add a custom <link> tag into head. Most oftenly it is used for RSS / ATOM feeds.
Sets the document's DOCTYPE.
Returns the current document type (default value <!DOCTYPE html>).
Sets the document's content type.
Returns the current content type (default value text/html).
Sets the document's XML name space (on XHTML doctypes).
Returns the current XML namespace (the default value is empty - no XML namespace on HTML5 documents).
Control page title, META description, META keywords and other META data and also the favicon.
Sets the page title.
Returns the current page title.
Sets the page META description.
Returns the current META description.
Sets any META tag (generator, description, author, etc).
Sets the page META keywords. $keywords should by an array of keywords or a comma separated string of keywords.
Set the document's favicon. $url is the full URL to favicon image (preferable of type ico or png).
Returns the current favicon.
Load built-in syntax highlighter.
Highlight source code. To use this method you must have first load the syntax highlighter with the loadHighlighter method.
Loads the built-in lightbox javascript library (currently colorbox). Also loads jQuery as colorbox uses jQuery.
In case you use if you use colorbox with iframe on XHTML doctypes you must switch content type to text/html as application/xhtml+xml does not support iframes in XHTML doctypes.
The elxisDocument library provides some methods very usefull to template developers in order to import into the templates modules, component and pathway in the exact spot they want. Also the htmlAttributes method is strongly recommended to be used in all templates.
Returns a string of HTML attributes to be appended into the document's <html> tag. The contents of this string is generated automatically by Elxis. All templates should use this.
Returns the number of modules assigned to the given modules position (eg. left). This method is a replacement of mosCountModules function from the Elxis 2009.x series.
Display the modules assigned to the given position. $style can be empty (default - puts a DIV with class module around the module), none (without surrounding DIV) and round (puts module into 3 DIVs - old method of rounded corners, left mostly for compatibility reasons). This method is a replacement of mosLoadModules function from the Elxis 2009.x series.
Display the output of a specific module. $style can be empty (default - puts a DIV with class module around the module), none (without surrounding DIV) and round (puts module into 3 DIVs - old method of rounded corners, left mostly for compatibility reasons). This method is a replacement of elxLoadModule function from the Elxis 2009.x series.
Sets the spot where component output will be displayed.
Displays the Elxis pathway. If $pathway_here is set to true the sentence "You are here" will be displayed before the pathway.
Develop engines to extend Elxis search to anything you can imagine