XF 1.5 print_r, echo, dump

Robert9

Active member
While programing PHP some hundred years ago, i could always know what is happen by showing the values of vars.
If i want to understand the way from a to z42, i could use easy echo "i am here now".

But how you do that in XF?
In some places i can work like this, but very often i cant go this way?
So how do you view your stack then?
 

Brogan

XenForo moderator
Staff member
For XF1 you can use Zend_Debug::dump($param);.

Also Zend_Debug::dump($parent->params['someParam']); and die(Zend_Debug::dump($param));.

In templates you use {xen:helper dump, $variable}.
 

Robert9

Active member
Shure, thank you.

in cp-files i can normally use dump, print_r or echo.
But when i try to get information from classes/methods of addons nested i cant get anything.
Somethimes nothing happens, sometimes i have an js error.
But i wont belive that you all work "blind" without control what happens every single step.

If you write an addon with a listener, and this addons has typical cp, dw, model you need to know what is happen in every single file, right?
I also cant use my debugger in the editor, because we need the forum to act.
 

Brogan

XenForo moderator
Staff member
I also cant use my debugger in the editor, because we need the forum to act.
If you are doing development and debugging then you really need to be doing that on a separate test/dev installation.

I would suggest a localhost set up.
 

Robert9

Active member
Shure. But how you do it to see all the vars?
Example:

th shop listens to res/cp/res actionRate

then we have four files with classes and methods.
To understand what the script makes i have to walk trough it step by step.
This is a really pain as long i cant see which values are transfered. I can try it in theory, but to find erros, i just want to see the arrays.
Sometimes i can provoke errors directly after a print_r to have a result on the screen, most of times i just stay blind. So it needs hours for small things that can be done in minutes if i would know the content of arrays in every step of the running process.
 
Last edited:
Top