Joomla! Programmierung/Framework/JDocument/setMetaData

Aus Joomla! Dokumentation
Wechseln zu: Navigation, Suche

ToDo übersetzen Sets the value of a meta data item.

Inhaltsverzeichnis

[Bearbeiten] Syntax

void setMetaData( $name, $content, $http-equiv )

where:

Argument Data type Description Default
$name string Name of meta data item. If $name is 'description' or 'generator' then the effect is the same as calling setDescription or setGenerator respectively. Meta data names are always folded to lowercase.
$content string Content of meta data item. If there is already a meta data item with the same value of $name (case independent) then this value will replace it.
$http-equiv Boolean True if meta data item is equivalent to an HTTP header field. false

[Bearbeiten] Example 1

$doc =& JFactory::getDocument();
$doc->setMetaData( 'tag-name', 'tag-content' );

Metadata is rendered differently depending on the document type. For HTML documents a meta tag is produced in the <head> section of the document, so the above example will produce:

<meta name="tag-name" content="tag-content" />

[Bearbeiten] Example 2

$doc =& JFactory::getDocument();
$doc->setMetaData( 'tag-name', 'tag-content', true );

Metadata is rendered differently depending on the document type. For HTML documents a meta tag is produced in the <head> section of the document, so the above example will produce:

<meta http-equiv="tag-name" content="tag-content" />

[Bearbeiten] See also

Meine Werkzeuge
Namensräume
Varianten
Aktionen
Navigation
Sonstiges
Team Navigation
Werkzeuge