Skip to content

General Dev – The $page object

gtbu edited this page May 26, 2021 · 8 revisions

Use global $page; in your functions to access it.

The $page object contains (almost) all data of the currently rendered page. You may read or modify them using the $page->property_name syntax.

Property Type Description
$page->admin_js array Array of links to JavaScript files to be loaded in admin mode.
$page->admin_links array Array of admin links (links in the Admin Top Bar)
$page->ajaxReplace array Array of instructions that belong to AJAX actions/responses.
$page->contentBuffer string Depending on the context or plugin hook from where this property is accessed, it may already contain parts or all the page HTML content, e.g. in GetHead, or still be empty – e.g. in Gadgets, which are processed early.
$page->css_admin array Array of links to CSS stylesheets to be only loaded in admin mode.
$page->css_user array Array of links to CSS stylesheets to be always loaded.
$page->file string Absolute path to the page's data file
$page->fileModTime string Unix Timestamp of last modification (as generated by `PHP time()`).
$page->file_sections array Array of all content sections including their HTML content and metadata.
$page->file_stats array Array with page meta data.
$page->get_theme_css boolean Boolean indicating if the theme css was/will be loaded. Depends on the request type.
$page->gpLayout string Id of the layout assigned to the page.
Use e.g. $gpLayouts[ $page->gpLayout ]
$page->gp_index string The page's index key as used in $gp_index, $gp_menu and $gp_titles.
$page->head string Inner HTML of generated content for the page's <head> section.
$page->head_js array Array of links to JavaScript files to be loaded. Note: This property's name originates from earlier versions, when scripts were loaded in the <head> section of the page. Since Typesetter 4.5 they will be loaded at the very end of the <body> element. So don't get fooled!
$page->head_script string String of JavaScript code to be written into a <script> tag at the end of the <body> element (not into the <head>, see note above.)
$page->head_force_inline boolean If true, resources will be included inline in the document.
$page->jQueryCode string String of JavaScript/jQuery code to be executed in jQuery's document-ready function.
$page->label string The page's name as it is shown in menus and as part of the the <title> element.
$page->meta_data array Array with meta data 'file_number' and 'file_type'
$page->menu_css_indexed boolean Defines if menu <li> elements get title-based class names.
$page->menu_css_ordered boolean Defines if menu <li> elements get level-based class names.
$page->meta_description string Contains a custom description, if set via Rename/Details.
$page->meta_keywords array Array of custom keywords, if set via Page/Options ⇒ Rename/Details.
$page->pagetype string Sort of 'role'. Possible values are 'display', 'admin_display', 'special_display', and 'update'.
$page->requested string Slug part of the page URL.
$page->title string Slug part of the page URL.
$page->TitleInfo array Array containing
label → (string) page label,
type → (string) comma separated section types
rel → (string) [no]index, [no]follow
$page->theme_addon_id string Value of Addon_Unique_ID as/if defined in Addon.ini
$page->theme_color string Name of the used layout (formerly called 'color')
$page->theme_dir string Absolute file system path of the theme directory
$page->theme_is_addon boolean true if the theme uses plugin hooks
$page->theme_name string Name of the used theme (e.g. 'Bootswatch Scss')
$page->theme_path string Relative path to the theme's layout/color subdirectory (e.g. '/themes/Bootswatch_Scss/Flatly')
$page->theme_rel string Similar to $page->theme_path
$page->visibility string NULL if page is publicily visible, 'private' if it is only visible for logged-in admins.
Clone this wiki locally