• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Debug messages

karll

Well-known member
#1
Is there an easy way to print debug messages, either to a log file or to the screen somewhere?

(Yes, I'm more or less a total newbie to PHP and XF add-on development.)
 

Chris D

XenForo developer
Staff member
#2
In PHP files, as we have access to the Zend Framework I prefer to use:

PHP:
Zend_Debug::dump($variable);
In XenForo templates, you can use:

Code:
{xen:helper dump, $variable}
 

Brogan

XenForo moderator
Staff member
#4
It is output on the page, depending on where you place it in the template.

For example, try entering this in the forum_list template:
Code:
{xen:helper dump, $user}
Place it above the hook for the node list and it prints out above the node list.
Place it at the end of the template and it prints out below.