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
Method | Description | Available from version |
ShowTitle | Displays the page title. | |
GetTitle | Returns the page title. | |
SetTitle | Sets the page title. | |
CSS styles
Method | Description | 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
Method | Description | 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
Method | Description | 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
Method | Description | 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
Module access permissions and user roles
Method | Description | Available from version |
GetUserRight | Returns the maximum user access permissions for a module. | |
Returns the
GetUserRoles | Returns an array of user roles for a module. | |
Current page address
Method | Description | 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
Method | Description | 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
Method | Description | 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
Method | Description | 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
Method | Description | 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
Method | Description | 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
Method | Description | 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. | |
Includes the module and displays a banner of the specified type.
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. | |