FAQ
+-----------------------------------------------------------------------------+
+-- PHP_Debug : A simple and fast way to debug your PHP code |
+-- |
+-- Support : Vernet Loic (qrf_coil@yahoo.fr) |
+-----------------------------------------------------------------------------+
== FAQ ========================================================================
== What are the different debug type ?
- PHP_DEBUGLINE_ANY : All available types (for search mode)
- PHP_DEBUGLINE_STD : Standart debug
- PHP_DEBUGLINE_QUERY : Query debug
- PHP_DEBUGLINE_REL : Database related debug
- PHP_DEBUGLINE_ENV : Environment debug ($GLOBALS...)
- PHP_DEBUGLINE_APPERROR : Custom application error
- PHP_DEBUGLINE_CREDITS : Credits information
- PHP_DEBUGLINE_SEARCH : Search mode in debug
- PHP_DEBUGLINE_DUMP : Dump any kind of variable
- PHP_DEBUGLINE_PROCESSPERF : Performance analysys
- PHP_DEBUGLINE_TEMPLATES : Included templates of the calling script
- PHP_DEBUGLINE_PAGEACTION : Store main page action
- PHP_DEBUGLINE_SQLPARSE : SQL Parse error
- PHP_DEBUGLINE_WATCH : A variable to watch
- PHP_DEBUGLINE_PHPERROR : A debug generated by the custom error handler
But in fact, these types are automatically used with the different public
functions of PHP_Debug.
== What are the different options available ?
<?php
$options = array(
'DEBUG_restrict_access' => false,
'DEBUG_allow_url_access' => true,
'DEBUG_url_key' => 'key',
'DEBUG_url_pass' => 'nounou',
'DEBUG_enable_watch' => false,
'DEBUG_replace_errorhandler' => true,
'DEBUG_lang' => 'FR',
'HTML_TABLE_view_source_script_name' => 'source.php'
);
$Dbg = new Debug($options);
$allowedip = array(
'127.0.0.1'
);
$Dbg->restrictAcess($allowedip);
?>
- DEBUG_restrict_access
Allow to restrict access to some IP only.
This is done by calling the restrict access function, with an array containing IP.
- DEBUG_allow_url_access
Allow to activate the display of the debug with a key and a password in
the URL of the executed script. (DEBUG_url_key, DEBUG_url_pass)
Ex : 'http://scripts.php?key=nounou'
- DEBUG_enable_watch
Allow to use the variable watcher (see index.php)
- DEBUG_replace_errorhandler
Allow to use the PHP_Debug error handler instead of the native PHP error
handler. In some cas (old PHP4 script) you may have lots of errors, it is
possible to desactivate it
- DEBUG_lang
Not used for now
- HTML_TABLE_view_source_script_name
Contains the relative path of the view source script that you use, update
with your location
== I don't understand the way stopTimer() function works can you explain me ?
Well in fact it is easy : (check index.php)
First you may add a debug info, of any tipe, then you simply have to call
the stopTimer function.
<?php
$Dbg->add("PERF TEST : 10000 iterations");
$y = 0;
for ($index = 0; $index < 10000; $index++)
{
$y = $y + $index;
}
$Dbg->stopTimer();
?>
== What are the different public functions available ?
Please check 'sources/index.php', there is an example with all the public
functions available in PHP_Debug.
Please........
Ahhhhhhh !!!!!!
- new Debug($array()) : PHP_Debug constructor
- restrictAcess($array) : Restrict debug to some IP
- add($mixed, $title (optional)) : Add the variable 'mixed' with the title 'string'
- dump(var, 'Foo') : Dump the content of the variable 'var' with the title 'foo'
- dumpVar(var, 'Foo') : Same as dump but can be called staticaly
- setAction($action) : Set the action of the scrip with $action (string)
- watch('watchedVariable') : Watch the variable called 'watchedVariable
- stopTimer() : Stop the timer for the last debug information added
- addDebugFirst($string) : Same as Add() but add the information in 1st position
- query($query) : Add a query wich sql scrip is contained in $query
- getRequiredFiles() : Return the list of required files in the script
- display() : Display the debug informations gathered until this call
== The debug is ugly it seems that there are no stylesheet associated with it ?
You must generate the stylesheet of PHP_Debug in your header section as follow
<head>
<?php
// Get default stylesheet
require_once 'Debug.php';
require_once 'Debug/Renderer/HTML_Table_Config.php';
$HTMLoptions = Debug_Renderer_HTML_Table_Config::singleton()->getConfig();
// Get stysheet and print it
print($HTMLoptions['HTML_TABLE_stylesheet']);
?>
</head>
== I have included your style, but it is still really ugly how can i apply my own stylesheet ? ;)
You have 2 options:
- Don't include my stylesheet as explained above and generate your own one,
respecting the PHP_Debug style names
- Modify the 'Debug/Renderer/HTML_Table_Config.php' where all the default
stylesheets are located
|