Documentation

CMain Class

CMain main page class.

Every time a new page is created, system creates a global object of this class. You can access the CMain object via the $APPLICATION variable.

Class methods

Page title

MethodDescription Available from version
ShowTitle Displays the page title.
GetTitle Returns the page title.
SetTitle Sets the page title.

CSS styles

MethodDescription Available from version
ShowCSS Shows HTML code to include CSS on a page.
GetCSS Returns HTML code to include CSS on a page.
SetTemplateCSS Sets path to file with CSS styles of the component.
SetAdditionalCSS Sets path to file with CSS styles.

Navigation chain

MethodDescription Available from version
ShowNavChain Displays HTML code with navigation chain.
GetNavChain Returns HTML code with navigation chain.
AddChainItem Adds an item to the end of navigation chain.

Menu

MethodDescription Available from version
GetMenu Returns a CMenu object for the current folder.
GetMenuHtml Returns a HTML code string with menu type for the current folder.
GetMenuHtmlEx Similar to GetMenuHtml but applies different type of menu template.

Page and section properties

MethodDescription Available from version
ShowProperty Displays page properties, with respect to the section properties.
GetProperty Retrieves the property value of the current page of section with respect to the section properties.
GetPageProperty Returns a property value for the current page.
GetDirProperty Returns the specified property of the current section.
GetPagePropertyList Returns an array of all page properties.
GetDirPropertyList Returns an array of the section properties.
SetPageProperty Sets the value of the specified property of the current page.
SetDirProperty Sets the value of the property for the current section.
ShowMeta Shows a section/page property as the <META> tag.
GetMeta Retrieves the page property decorated in the <meta> tag.

Files

MethodDescription Available from version
SaveFileContent Saves the page to disk.
GetFileContent Retrieves the file contents.
GetFileRecursive Searches for a specified file name recursively up the folder hierarchy.
GetFileAccessPermission Retrieves the access permission to a file or folder.
SetFileAccessPermission Sets the access permissions for a file or folder.
CopyFileAccessPermission Copies the access permissions of one file or folder to another file or folder.
RemoveFileAccessPermission Deletes the access permissions of a file or folder.

Module access permissions and user roles

Returns the
MethodDescription Available from version
GetUserRight Returns the maximum user access permissions for a module.
GetUserRoles Returns an array of user roles for a module.

Current page address

MethodDescription Available from version
GetCurUri Returns an address for the current page with parameters.
GetCurPage Returns an address for the current page without parameters.
GetCurPageParam Returns URL of the current page with added new and optionally modifies (adds or removes) the URL parameters.
GetCurDir Returns directory of the current page.
SetCurPage Sets URL for the current page.

Control toolbar

MethodDescription Available from version
ShowPanel Displays HTML code for control toolbar in the public section of the site.
GetPanel Returns HTML code for the public section control toolbar.
AddPanelButton Adds a button to the public section control toolbar.
GetPublicShowMode The method returns the current display mode for the administrative section.

JS and tagshead

MethodDescription Available from version
AddHeadScript Adds Java scripts in the site and component templates.
AddHeadString Adds a string to the <head>…</head> section of the site.
ShowHead Displays main <head> tag fields in the site template.
ShowHeadStrings Shows special styles, JavaScript strings, or a random HTML code.

Cookies

MethodDescription Available from version
set_cookie Sets the cookie value.
get_cookie Returns the value of a cookie.
ShowSpreadCookieHTML Displays HTML code indended for spreading cookies among domains.
Includes any files within the page body, prologue or epilogue

Components

MethodDescription Available from version
IncludeFile Includes arbitrary files and components such as page body, prologue or epilogue.
GetTemplatePath Returns full path to file via the component connection algorithm.
IncludeComponent The method includes component 2.0.

Exceptions

MethodDescription Available from version
GetException Returns a CApplicationException class object, containing the last exception.
ThrowException Registers the 'msg' exception with the ID code.
ResetException Removes the last exception.

Other methods

Includes the module and displays a banner of the specified type.
MethodDescription Available from version
IncludeAdminFile Includes script with the administrative prologue and epilogue attached.
IncludeString Displays an arbitrary string (HTML code) bordered in the frame, with the specified icons display in the right upper corner.
GetShowIncludeAreas Returns the status of the "Show included areas" button on toolbar panel.
AddBufferContent Allows to create delay functions.
ShowBanner Includes the 'Advertising Ads, banners' module and displays a banner on success.
GetSiteByDir Retrieves site by the specified directory and domain.
AuthForm Shows the authorization form.
IsHTTPS Returns "true" if the current protocol is secured (HTTPS).
AddViewContent Specifies the viewed content location, generated below.
ShowViewContent Specifies content, displayed by the AddViewContent method.

The use of the last two methods primarily allows to avoid duplication of components and redundant cycles.

ConvertCharset Converts strings from different encodings.
ConvertCharsetArray Converts data from encodings.
RestartWorkarea Allows to reset content of the work area of the public site section.


© «Bitrix24», 2001-2024
Up