General Introduction
Settings
AddBufferContent
AddChainItem
AddHeadScript
AddHeadString
AddPanelButton
AddViewContent
AuthForm
CaptchaCheckCode
CaptchaGetCode
ConvertCharset
ConvertCharsetArray
CopyFileAccessPermission
GetCSS
GetCurDir
GetCurPage
GetCurPageParam
GetCurUri
GetDirProperty
GetDirPropertyList
GetException
GetFileAccessPermission
GetFileContent
GetFileRecursive
GetMenu
GetMenuHtml
GetMenuHtmlEx
GetMeta
GetNavChain
GetPageProperty
GetPagePropertyList
GetPanel
GetProperty
GetPublicShowMode
GetShowIncludeAreas
GetSiteByDir
GetTemplatePath
GetTitle
GetUserRight
GetUserRoles
IncludeAdminFile
IncludeComponent
IncludeFile
IncludeString
IsHTTPS
MoveJSToBody
RemoveFileAccessPermission
ResetException
SaveFileContent
SetAdditionalCSS
SetCurPage
SetDirProperty
SetFileAccessPermission
SetPageProperty
SetTemplateCSS
SetTitle
ShowBanner
ShowBodyScripts
ShowCSS
ShowHead
ShowHeadScripts
ShowHeadStrings
ShowMeta
ShowNavChain
ShowPanel
ShowProperty
ShowSpreadCookieHTML
ShowTitle
ShowViewContent
ThrowException
get_cookie
set_cookie
Complex logic in filter
Special variables
Special constants
AddHeadScript
CMain::AddHeadScript( $src, $additional=false )
The method adds java-scripts in the site and component templates. The procedure of adding and merging java scripts corresponds to the procedure for API calls. Exception: when merging, first the core scripts are grouped, and then the template scripts and pages are printed. Non-static method.
Parameters
Parameter | Description | Available from version |
---|---|---|
src | path to script from the site root | |
additional |
Examples of use
If the link to the script must be added into the body of the headtag (scr - link to script):
<?$APPLICATION->AddHeadScript('scr');?>
To add additional files to the head, the following must be used:
<? // for js-files $APPLICATION->AddHeadScript('/bitrix/templates/.default/additional.js'); // for css-files $APPLICATION->SetAdditionalCSS("/bitrix/templates/.default/additional.css"); ?>
© «Bitrix24», 2001-2023
Up