COM_EASYBLOG_POSTED COM_EASYBLOG_BY COM_EASYBLOG_ON COM_EASYBLOG_IN
  • COM_EASYBLOG_FONT_SIZE: COM_EASYBLOG_FONT_LARGER COM_EASYBLOG_FONT_SMALLER
  • COM_EASYBLOG_HITS_TOTAL
  • COM_EASYBLOG_COMMENT_COUNT_PLURAL

How to debug your joomla code

Example 1:
The simplest way to see what is going on inside your code is to temporarily add echo statements for variables to show their values on the screen. For example, say you want to know what the value of some variables are when $i is "5". You could use code like this:
for ( $i = 0; $i < 10; $i++ ) {
if ( $i == 5 ) {
echo '$i=' . $i;
// other echo statements
}
}
This works for simple situations. However, if you are planning on doing a lot of Joomla! development, it is worth the effort to install and learn an integrated development environment (IDE) that includes a real PHP debugger.


Example 2:
Your code won't always display simple echo statements. In that case you can try this alternative, still easy way:

 

JFactory::getApplication()->enqueueMessage( 'Some debug string(s)');

Example 3:
Using the PHP Expert editor

Another option is the PHP Expert editor with an installed extension for debugging. Add the following lines to the php.ini file:
extension=php_dbg.dll
[Debugger]
debugger.enabled=on
debugger.profiler_enabled=off
It is best to set profiler_enable to "off". Then you need to set options in the Run/Options menu to use HTTP-server and the directory in which your script is located.
If all options are correct, you may run your script in debug mode by clicking on the Debug button (F8)

 
0

COM_EASYBLOG_COMMENTS

COM_EASYBLOG_LEAVE_YOUR_COMMENT

COM_EASYBLOG_GUEST SATURDAY, 18 NOVEMBER 2017