Patrick's CMS

Page ID

The file /inc/html.php sets a PHP variable: $pageID which contains a 'string' of text identical to the page title. As an example, for this page the string is cms-page-id (the same as in the URL). It is specific to each page so can be used to script things to happen in that page alone, not all pages. The default theme colours page has a white navigation bar by activating an additional stylesheet 'navbar.css'. The $pageID 'csm-colours' is used in /inc/stylesheets.php to activate 'navbar.css' for that page only:

if ($pageID == 'colours') {
  echo "\n";
  echo'<link rel="stylesheet" media="screen" href="' . LOCATION . 'css/navbar.css">';
}

$pageID is already used by the CMS in /inc/extra-content.php to make the 'extras' and comments page-specific. It is also used in /inc/extra-head.php to make Open Graph tags page-specific, and in /inc/top.php and /inc/menu.php.

These files will be able to access the $pageID in this load order:

/inc/error-reporting.php
/inc/top.php
/inc/ppp.php
/inc/stylesheets.php
/inc/extra-head.php
/inc/extra-body.php
/inc/menu.php
/inc/login-form.php
/inc/content.php
/inc/extra-content.php
/inc/history.php
/inc/footer.php
/inc/tracking.php

If you are familiar with PHP scripting, by using:

if ($pageID == 'page-title') {

... you can add almost anything specific to the page page-title, or any other page, or even a set of pages:

if (($pageID == 'page-title') || ($pageID == 'another-page')) {

etc.

Information

Page last modified: 06 February, 2024