A debug lifesaver
Permalink
Have found this a very convenient way of debugging any C5 PHP code. Have spelt things out so hope it's clear
1. Install thishttp://raveren.github.io/kint/ . In the example below
it is installed at /var/www/kint on the server. It can be
installed anywhere else but the path in the code below needs to
be adjusted
2. Add the code below last thing to your theme footer and read on
3. Anywhere in C5 code you can insert monitor points.
Kint will also which line of code the monitor point comes from
Using the GET variable to turn it on makes it quite convenient
PM me if you get stuck
1. Install thishttp://raveren.github.io/kint/ . In the example below
it is installed at /var/www/kint on the server. It can be
installed anywhere else but the path in the code below needs to
be adjusted
2. Add the code below last thing to your theme footer and read on
<?php // This next line checks for a ?debug or &debug string in the URL // that the browser is pointing to if (isset($_GET['debug'])){ // Include the Kint debugger include_once("/var/www/kint/Kint.class.php"); // Set up the variables you want to monitor global $u; // C5 User object $uid = $u->getUserID(); // Current User ID $ui = UserInfo::getByID($uid); $cvName = $c->vObj->cvName; $cvDescription = $c->vObj->cvDescription; // Get a list of all PHP vars used in c5 $vars = get_defined_vars(); // List of all the variables you want to
Viewing 15 lines of 21 lines. View entire code block.
3. Anywhere in C5 code you can insert monitor points.
Kint will also which line of code the monitor point comes from
Using the GET variable to turn it on makes it quite convenient
PM me if you get stuck
Thanks, this seems helpful indeed.
But wouldn't this be a better solution?https://github.com/tomasfejfar/enhanced-dump...