Documentation

ShowHeadStrings

CMain::ShowHeadStrings(
 additional=false
)

The method shows special styles, such as JavaScript or an arbitrary HTML code.

The method uses the delay function technology and is used in a site template to display an arbitrary code. For example, such code is defined in components via CMain::AddHeadString().

ShowHeadStrings - similar to the methods ShowMeta, ShowTitle, ShowCSS, only its application is more universal. Non-static method.

See Also

Examples of use

<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?=LANG_CHARSET;?>" />
<?$APPLICATION->ShowMeta("robots")?>
<?$APPLICATION->ShowMeta("keywords")?>
<?$APPLICATION->ShowMeta("description")?>
<title><?$APPLICATION->ShowTitle()?></title>
<?$APPLICATION->ShowCSS();?>
<?$APPLICATION->ShowHeadStrings()?>
<?$APPLICATION->ShowHeadScripts()?>
</head>
<body>
...

The below example demonstrates the use of CMain::AddHeadString(). The file \bitrix\modules\main\include\epilog_after.php uses the following code:

...
if($bShowStat && !$USER->IsAuthorized())
{
require_once($_SERVER["DOCUMENT_ROOT"].BX_ROOT."/modules/main/interface/init_admin.php");
$GLOBALS["APPLICATION"]->AddHeadString($GLOBALS["adminPage"]->ShowScript());
$GLOBALS["APPLICATION"]->AddHeadString('<script type="text/javascript" src="/bitrix/js/main/public_tools.js"></script>');
$GLOBALS["APPLICATION"]->AddHeadString('<link rel="stylesheet" type="text/css" href="/bitrix/themes/.default/pubstyles.css" />');
}
...


© «Bitrix24», 2001-2022
Up