Event Hooks
Sitecmd provides several hook points (named events) which are called at specific points during execution.
Event Usage
To make use of the event hooks, you should create a file named events.php in the site/_media/ directory.
Events pass data through references, so you shouldn't return any data from your functions, but rather assign the new value to the referenced variables.
Event List
Below is a list and description of each Sitecmd event. Please note that these are being added fairly often, and you're welcome to suggest new event hooks by submitting a feature request.
router-request-file (&$request, &$extension)
Calls the physical file to load as a page, based upon the URL request.
include-page-template (&$sitecmd_template_name)
Overrides the page template for the requested page.
router-404 (&$request, &$extension)
Runs when an HTTP 404 error is triggered.
page-content (&$content)
Runs when the page content has been loaded but before it's output to the browser.
pre-http-auth (&$file)
Runs just after the headers have been sent to initiate HTTP authentication, but before the credentials have been submitted.
http-auth-ok (&$file)
Runs when HTTP authentication is successful, just before returning the requested file - i.e. the username and password are valid.
http-auth-fail (&$file)
Runs when HTTP authentication has failed, just before the 401 template file is returned.