Page
The macro is designed to work with the site pages created in the "structure" section in the administrative panel.
- On each page of the template you can see the information about the user uploaded page.
Just write in template
pageInfoIt return a object with information of the page.
You can see this object by writing in a template next string.
!= logger(pageInfo)This will display an object of pageInfo on the page.
- Get pages by id's
macro_getPagesById(params)"params" is an object that can contain the following keys:
- pageIds (required) - id's of pages in structure tree (array of numbers)
- groups - text id's of groups, information about which, must be selected (array of strings)
- props - text id's of fileds, information about which, must be selected if value doesn't empty (array of strings)
- noActive - if it 'true' select inactive pages, default - false (boolean)
Example response
array(1) { [2]=> array(10) { ["text"]=> string(6) "Global" ["templateId"]=> string(2) "55" ["parentId"]=> string(1) "0" ["url"]=> string(10) "/__global/" ["h1"]=> string(0) "" ["title"]=> string(0) "" ["description"]=> string(0) "" ["active"]=> bool(false) ["childrenActive"]=> bool(false) ["groups"]=> array(2) { ["menu_group"]=> array(3) { ["id"]=> string(2) "86" ["text"]=> string(4) "Menu" ["props"]=> array(1) { ["site_title__global"]=> array(4) { ["id"]=> string(2) "82" ["text"]=> string(10) "Site title" ["value"]=> string(17) "Exotic plant shop" ["typeId"]=> string(1) "1" } } } ["search__global"]=> array(3) { ["id"]=> string(2) "96" ["text"]=> string(6) "Search" ["props"]=> array(1) { ["search_limit__global"]=> array(4) { ["id"]=> string(3) "109" ["text"]=> string(12) "Search limit" ["value"]=> string(2) "10" ["typeId"]=> string(1) "2" } } } } } }- active - page we are on (boolean)
- childrenActive - page we are on is children of this (boolean)
- Get child pages
macro_getPages(params)"params" is an object that can contain the following keys:
- childOf (required) - id of parent page (string)
- depth - sample of the page in depth relative to the parent (number)
- typeIds (required) - type id's of pages (array of number)
- groups - text id's of groups, information about which, must be selected (array of strings)
- props - text id's of fileds, information about which, must be selected if value doesn't empty (array of strings)
- filters - property values by which the pages will be selected. Example:
- chexbox types
{name:"propertyName", equal:1} - number types
{name:"propertyName", equal:1}
{name:"propertyName", min:1, max: 10} - string types
{name:"propertyName", equal:'propertyValue'}
{name:"propertyName", contains: "value"}
- chexbox types
- begin - offset pages (number)
- limit - limit pages (number)
- noActive - if it 'true' select inactive pages, default - false (boolean)
- sort - sort order ('ASC' or 'DESC') (string constant)
- sortBySortNum - sorting will be performed by the position of pages in the structure section (boolean). Default - true. If you want to sort the pages alphabetically, then set this value in the false and do not set 'sortByField' value
- sortByField - field (identifier) by the value of which the sorting will occur (string)
- Create page
macro_createPage(parentId: number, pageName: string, templateId: number) - Change page type
macro_changePageType(pageId: number, typeId: number) - Change page name
macro_changePageName(pageId: number, pageName: string) - Change general fileds of page
macro_changeGeneralFieldOfPage(pageId: number, propertyName: string, value: string | number)propertyName - 'active' | 'url' | 'h1' | 'title' | 'description' | 'noIndex'
value - if property is checkbox it must be number, else string
- Update field of page
macro_updateFieldPage(id: number, fieldIdentifier: string, value: string | number)if property is checkbox, number or select it must be number, else string. - Breadcrumbs
macro_getBreadCrumbs()
