Saltar al contenido

JDocument – Joomla 1.5

http://docs.joomla.org/JDocument

JDocument is an abstract class which provides a number of methods and properties appropriate for a range of document types. Some of the methods listed will be overridden by the child class so you should check the child class documentation for further information.

Contents

[hide]

Availability

From Joomla 1.5 With  additional functionality in Joomla 1.6

Defined in

/libraries/joomla/document/document.php

Extends

Extended by

Get and Set Methods

Properties which do not have specific get or set methods listed here can be retrieved or set using the inherited JObject->get method.

Get method Set method Description Property
getBase setBase Document base URI. Usually empty. $base
getBuffer setBuffer Contents of the document buffer.
getCharset setCharset Document character set encoding. Default is ‘utf-8’.
getDescription setDescription Document description. Also available using getMetaData and setMetaData. $description
getDirection setDirection Document language reading direction. Default is ‘ltr’ indicating left-to-right. Use ‘rtl’ for right-to-left. $direction
getGenerator setGenerator Document generator. Also available using getMetaData and setMetaData.
getHeadData setHeadData Implemented in child classes.
getLanguage setLanguage Document language tag. Default is ‘en-GB’. $language
setLineEnd Document line end style. May be ‘win’, ‘unix’, ‘mac’ or a custom style.
getLink setLink Document URL. Usually empty. $link
getMetaData setMetaData Document metadata tag. See separate reference pages on these methods.
getModifiedDate setModifiedDate Document last modified date. Usually empty.
setTab String used to indent HTML. Default is an ASCII TAB character.
getTitle setTitle Document title. $title
getType setType Document type.

Other Methods

Method name Description
addScript Adds a linked script to the document. See separate reference page for further information.
addScriptDeclaration Adds a script to the document. See separate reference page for further information.
addStyleSheet Adds a linked stylesheet to the document. See separate reference page for further information.
addStyleDeclaration Adds stylesheet declaration to the document. See separate reference page for further information.
getInstance Returns a reference to the global JDocument object of a given type, only creating it if it doesn’t already exist. In most cases you should use JFactory::getDocument instead.
loadRenderer Loads a document renderer.
render Renders the document.

Importing

jimport( 'joomla.document.document' );

Adding support for new document types

New document types are added by creating a new sub-directory under the /libraries/joomla/document/ directory with the same name as the type. For example, to add a document type called «mytype», you would create the directory /libraries/joomla/document/mytype. In this directory you must then create a file called mytype.php which will contain the class definition for JDocumentMytype which extends JDocument. Look at the code for existing document types to see what needs to be done.

Si te ha interesado este artículo y deseas un apoyo o asesoría en algún requerimiento, envíame un mensaje a: (info@juliopari.com) o sino a través de Linkedin: https://www.linkedin.com/in/juliopari/

Etiquetas: