« HS-CMS documentation home

Variables and Functions

Lists of variables, classes, functions, constants, and so on defined by HS-CMS are listed below, but first, we discuss conventions.


Global variables, classes, and functions tend to follow these conventions:

  • Start with HS_ and then follow normal conventions:
    • Classes CapitalizedLikeThis
    • Most variables and keys are capitalizedLikeThis (except for the pseudo-namespace) -- ex: $HS_sites, $HS_requestUrl. Notice the standard of capitalizing acronyms like URL and ID as if they were normal words! If that's confusing, remember it's just like JavaScript's document.getElementById.
    • Variables and array keys whose names are taken from database fields are capitalized_like_this, just like the database column names. ex: $HS_page['robot_friendly']
    • Functions capitalized_like_this() -- if the typing underscores bothers you, consider typing with Dvorak (I’m half serious).
  • Global constants are really members of a global array variable

Global Variables, Arrays, Objects, and Constants (not classes)


The current installation root, containing "sites," "doc," "core," "filters," and the other directories. This variable is defined like this in page.php:


and is thus available to every file except for config_installation.php. (If that's a problem, contact Alan Hogan and complain, but it shouldn't be one.)


String with the path to the current site's directory, including the trailing slash. Example value: /users/username/homepages/hs-cms/welcome/, /path/to/hs-cms/example/. Example usage: REQUIRE_ONCE HS_SITE_DIR.'config_site.php';


String with the current request URI without beginning or trailing slashes (except for the root, in which case this variable holds just a slash, '/') and without any GET variables.

Browser address:       http://example.com/some/page/?foo&bar=1
$_ENV['REQUEST_URI']:  /some/page/?foo&bar=1
HS_requestUrl:         some/page


An array available to render engines. It's based on the original page information in the database, but by the time it reaches the render engine, it's no longer just the raw data. Details follow.

This array has the following keys:


When applying formatting and cache, this is somewhere between the original, unformatted (e.g. still Markdown) content and the final XHTML (assuming you are outputting XHTML).

By the time it's in the rendering engine, it's the final product, ready to print() into the document.


String, content title, plaintext (entities need encoded by render engine).


Description, appropriate for being displayed in a list of pages and for inclusion in the pages's data. Still plaintext (entities need encoded by render engine).


Other keys are exactly as defined here.

$HS_cache, HS_Cache

See caching

Global functions

...are there any?...