Documentation

GetMeta

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

The method retrieves the page property decorated in the tag. If the page does not have the required property, the method searches for the one in parent sections recursively. If the method fails to find the required property, an empty string is returned. Non-static method.

Parameters

ParameterDescription Available from version
idPage property or section ID, which value will be displayed in the meta tag "content" attribute:
<meta content="value" ...>
meta_nameThe meta tag "Name" attribute:
<meta name="meta_name" ...>
Optional parameter. By default equals to the property_id value.
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

<?
$meta_keywords = $APPLICATION->GetMeta("keywords_prop", "keywords");
if (strlen($meta_keywords)>0) echo $meta_keywords;
?>


© «Bitrix24», 2001-2024