Debugging
Debugging is currently enabled with a very simple switch. You can always turn
on debugging, by setting the DEBUG constant to true in the init.php script,
but the simplest method is to simply pass a debug value in the querystring:
http://www.syntaxcms.org/section/support/?debug=1.
If $_GET['debug'] is set, as in example above, then DEBUG constant will be
true. All debug messages are currently logged to the debug log — so even turning
debugging on in a production server will not produce any on-screen debugging
messages.
In the source code debugging messages are entered like this:
if (DEBUG)
{
trigger_error("My Debug Message", E_USER_WARNING);
}
If $_GET['debug'] is set to a value greater than 1 — e.g. /section/support/?debug=2
— then the PXDB_DEBUG constant will be set. This will echo all Syntax
debugging messages to the screeen; to change this behavior, you would have to
modify the pxdb::print_debug() method as this is the handler function for all
Syntax debugging.
Error Handling
Errors in SyntaxCMS use the native trigger_error() function. Fatal errors in class methods or functions should preferably trigger an E_USER_WARNING and return false, so that errors bubble up to the user level.
The Site::errorHandler() method is registered as the error handler to use for
PEAR errors. All PHP errors are translated into PEAR errors using a simple function.
(You cannot easily use the same error handler function for PHP errors and PEAR
errors because they expect different parameters.)
Cache
By default SyntaxCMS caches navigation and module output — when indicated that
this is appropriate in the config/modules.conf.php file. The cache
is automatically flushed (re-built) when a change is made to content or site
navigation; however, while developing templates for a site this behavior may
still be unacceptable. If a site is under heavy development you probably want
to simply turn off caching in the init/init.content.php.
You can also, however, pass parameters in the query string to control the cache:
Disable cache (for current request only): http://www.syntaxcms.org/section/support/?nocache=1
Flush (re-create) the cache: http://www.syntaxcms.org/section/support/?flushcache=1
