Documentation

ShowMeta

CMain::ShowMeta(
 string id,
 string meta_name = false,
 bool bXhtmlStyle = true
)

The method displays the page property as the META tag. The method allows to use special characters (HTML entities) in the property values.

If the page does not have the required property, the method searches for the one in parent sections recursively up to the site root. If the property value is not defined, the method will display empty string.

This method utilizes the delay function technology allowing to specify meta tags (using CMain::SetPageProperty or CMain::SetDirProperty) after the site prologue is displayed.

Non-static method.

Parameters

ParameterDescription Available from version
property_idPage or section property ID which value will be rendered in the content attribute of the meta tag "content":
<meta content="value" ...>
meta_nameAttribute of the meta tag "name":
<meta name="meta_name" ...>
Optional parameter. By default, equals to property_id.
bXhtmlStyleThis parameter defines the standard of HTML tags. If true, the tags are displayed according to the XHTML standard (<meta />), otherwise, the HTML 4 standard is used (<meta>). This parameter was introduced in the kernel version 8.5.3. Optional, by default the value is true.8.5.3

See Also

Examples of use

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?=LANG_CHARSET?>">
<META NAME="ROBOTS" content="ALL">
<?$APPLICATION->ShowMeta("keywords")?>
<?$APPLICATION->ShowMeta("description")?>
<title><?$APPLICATION->ShowTitle()?></title>
<?$APPLICATION->ShowCSS();?>
</head>
<body link="#525252" alink="#F1555A" vlink="#939393" text="#000000">
...


© «Bitrix24», 2001-2022
Up