Topics

Handy Functions

Some handy coding tricks for PHP  and Templates.

eDebug - PHP & Templates

There is a php and smarty function which gives you quick access to display or dump variables, structures, objects, arrays, etc... when 'Development' mode (Error Reporting) is turned on.  It displays nothing when 'Development' mode is turned off.  It's available in both php files and with templates.  You can also add a "Halt" option in the php call.

Here's a php snippet:

eDebug($object);

Here's a php snippet that will halt after dumping the variable:

eDebug($object, true);

Here's a template/smarty snippet:

{eDebug var=$object}

eLog - PHP

There is a php function which gives you quick access to dump variables, structures, objects, arrays, etc... to a log file.  It can be set to work when 'Development' (Error Reporting) mode is either on or off. You can optionally pass it a "type" of entry, the "file" to use (default is 'tmp/exponent.log'), and the miinimum Development level to work under (0 is default which is always).

Here's a basic php snippet:

eLog($object);

Here's a php snippet that will only log the dump in Development mode:

eLog($object, "TRACE", 'tmp/tracedump.log', 1);

debug - Templates

There is a smarty function which gives you quick access to display or dump all the template variables, structures, objects, arrays, etc... into a new popup window. You must make sure your browser is not blocking popup windows!  It's only available within templates and does NOT depend on the 'Development' (Error Reporting) mode.

Here's a template/smarty snippet:

{debug}