RtkDev:Cookbook

From RevTK

Jump to: navigation, search
RevTK Developers Hub
All articles


Contents

Debugging

Logging values

Use static helpers to print out error messages in a nice coloured box:

DBG::out('woops');

If you get a 'Content Encoding Error' that means that the error output came before the HTTP headers were sent. Then use exit() to skip the buffering:

DBG::warn('reached this part of the code'); exit;

The ::error() method will produce an exception, in production environment this will generate the Error 500 template page.

Logging SQL statements

If you have a coreDatabaseSelect object, its __toString() method will automatically convert to a string:

$select = $db->select( 'firstname' )->from('users');
DBG::warn($select);
// => should print out SELECT firstname FROM users

Cookies, User, Request

Try these also:

// shows contents of the php $_COOKIE array
DBG::cookies();
// shows user attributes and user credentials, from the user session
DBG::user();
// show request object
DBG::request();
Personal tools