phpDocumentor PHP_Debug
[ class tree: PHP_Debug ] [ index: PHP_Debug ] [ all elements ]

FAQ

+-----------------------------------------------------------------------------+
+-- PHP_Debug : A simple and fast way to debug your PHP code                  |
+--                                                                           |
+-- Support : Vernet Loic (qrf_coil@yahoo.fr)                                 |
+-----------------------------------------------------------------------------+


== FAQ ========================================================================


== 1 - Why direct links to PhpMyadmin don't work ? ============================

You must configure the path and database name. (replace with you own paths)

<?php

$Dbg->ViewSourceScriptPath = "/myproject/functions/";
$Dbg->ViewSourceScriptName = "source.php";

?>


== 2 - Why when I add query to debug info i have no link to PhpMyAdmin ? ======

It is because you do not use the correct debugline type, you must add debug
info for queries, like this :

<?php

$Dbg->addDebug("Select email from users", DBGLINE_QUERY, __FILE__, __LINE__);

?>


== 3 - What are the different debug type ? ====================================

Here is the list (check doc : Constants)

- DBGLINE_STD           : Standart debug, fonctionnal or other
- DBGLINE_QUERY         : Query debug
- DBGLINE_QUERY_REL     : Database related debug
- DBGLINE_ENV           : Environment debug ( $GLOBALS... )
- DBGLINE_CURRENTFILE   : Output current file that is debugged
- DBGLINE_APPERROR      : Debug Error 
- DBGLINE_CREDITS       : Credits
- DBGLINE_SEARCH        : Search mode in debug
- DBGLINE_OBJECT        : Debug object mode
- DBGLINE_PROCESSPERF   : Performance analysys
- DBGLINE_TEMPLATES     : Debug included templates
- DBGLINE_PAGEACTION    : Debug main page action 
- DBGLINE_ARRAY         : Debug array mode
- DBGLINE_SQLPARSE      : SQL Parse error

Some debugtype are automatically added depending the debugmode.


== 4 - When searching for a given string, some debug infos still appears even
the requested string is not present, why ?

True, actually : DBGLINE_CURRENTFILE, DBGLINE_CREDITS, DBGLINE_SEARCH
DBGLINE_PROCESSPERF debug types are always displayed in search mode.

You can change this behaviour by setting for example :

<?php

$Dbg->DisplayTypeInSearch[DBGLINE_CURRENTFILE] = false;

?>


== 5 - Super arrays are great, but how may i have $GLOBALS super array to 
display all environment variables that is possible to see ?

You must do as followning :

<?php

$Dbg->ShowGlobals = true;

?>


== 6 - Include path are far too long when displaying included or required
files, how should i truncate it ?

You must use addRequiredFilesPattern() function, and check that 
$RemoveTemplatesPattern variable is set to true

<?php

$Dbg->RemoveTemplatesPattern = true;
$Dbg->addRequiredFilesPattern('/home/pc/project/group/p/ph/');

?>

This pattern will be truncated from paths.


== 7 - I do not understant the way DebugPerf works can you explain me ?

Well in fact it is easy : (check index.php)

First you may add a string for this debug info :

<?php

$Dbg->addDebug('This script is quiet long because i get RSS files 
	directly from SourceForge.net --->', DBGLINE_STD, __FILE__, __LINE__);

?>


And then you must call DebugPerf function at the start and at the end of
the part of code you want to monitor, like this : 

<?php

// Monitor time to retrieve RSS feed, start timer
$Dbg->DebugPerf(DBGLINE_STD);

$rss_news =& new XML_RSS($rss_news_url);
$rss_news->parse();
$rss_summary =& new XML_RSS($rss_summary_url);
$rss_summary->parse();

// Stop timer
$Dbg->DebugPerf(DBGLINE_STD);

?>

/!\ But remember ! You must use the SAME DebugType for this 3 functions 
calls (here DBGLINE_STD) , if not, the time process will be affected to
another debugline, or may have unpredictable results...


== 8 - I am bored with seeing your credits, how may i remove it ? =============

As you want man...  :/

<?php

$Dbg->DisableCredits = true;

?>

:)


== 9 - I don't want to see included files, how can i remove it ? ==============

Easy. Try this...

<?php

$Dbg->ShowTemplates = false;

?>

Check also the different debugmode availables :

- DBG_MODE_OFF       : Debug mode is OFF
- DBG_MODE_USERPERF  : Base debug mode
- DBG_MODE_QUERY     : DBG_MODE_USERPERF + queries
- DBG_MODE_QUERYTEMP : DBG_MODE_QUERY + included files
- DBG_MODE_FULL      : All available debug infos
(including $GLOBALS array that is quiet big)
- DBG_MODE_AUTO      : Mode auto take the mode of Debug Object

I usually use DBG_MODE_QUERYTEMP mode.

You can set the mode like this :

<?php

// Create the debug object with a specified debug mode
$Dbg = &new Debug(DBG_MODE_QUERYTEMP);

?>


== 10 - You claim to be XHTML compliant but the stylesheet is generated in ====
the body, what the f*$ ? 

You need to enable the XHTML output, first :


<?php

// Generate XHTML
$Dbg->genXHTMLOutput = true;

?>

Then you need to generate the stylesheet in your html <head> section

(check header.php)

<head>
...

<?php

/**
 * Generate StyleSheet  
 */
print($Dbg->generateStyleSheet());

?>

...
</head>


Documentation generated on Sun, 12 Jun 2005 14:52:13 +0200 by phpDocumentor 1.3.0RC3