hankii Posted January 23, 2018 Share Posted January 23, 2018 Hi, I am sorry if i am posting this in the wrong area, i hope not. Is there a way to dump all variables per template? Something like XF has? Example: {xen:helper dump, $visitor} Thanks. Link to comment Share on other sites More sharing options...
Adriano Faria Posted January 23, 2018 Share Posted January 23, 2018 {{var_dump( $variable );exit;}} Not sure you need the EXIT; you need to try. Link to comment Share on other sites More sharing options...
hankii Posted January 23, 2018 Author Share Posted January 23, 2018 14 minutes ago, Adriano Faria said: {{var_dump( $variable );exit;}} Not sure you need the EXIT; you need to try. This worked, thanks! Link to comment Share on other sites More sharing options...
opentype Posted January 23, 2018 Share Posted January 23, 2018 {{$varoutput=var_dump($variable);}} {$varoutput} I always do it like this. Link to comment Share on other sites More sharing options...
Bluto Posted March 8, 2018 Share Posted March 8, 2018 On 1/23/2018 at 2:22 PM, opentype said: {{$varoutput=var_dump($variable);}} {$varoutput} I always do it like this. @opentype Will that only work in the development mode? Link to comment Share on other sites More sharing options...
opentype Posted March 8, 2018 Share Posted March 8, 2018 I don’t think so. Link to comment Share on other sites More sharing options...
Midnight Modding Posted March 8, 2018 Share Posted March 8, 2018 That should work whether in dev or not, I would think. PHP has to work in the templates when IN_DEV is off, so looks correct. Link to comment Share on other sites More sharing options...
Marcher Technologies Posted March 10, 2018 Share Posted March 10, 2018 {expression="var_export($variable, true)"} I use the above. var_dump does not return a result. it literally just prints to screen. On 1/23/2018 at 2:22 PM, opentype said: {{$varoutput=var_dump($variable);}} {$varoutput} I always do it like this. To clarify, the second line there, and indeed, setting the $varoutput variable itself, is a meaningless no-op because var_dump was used. {{var_dump($variable);}} is the exact same thing as the code you posted. I prefer var_export both for control of placement of result and because I have seen var_dump do nothing on some servers due to the output buffering used in the suite, thus var_export consistently gives me the debug i'm looking for without fighting install-specific semantics. Link to comment Share on other sites More sharing options...
Bluto Posted March 18, 2018 Share Posted March 18, 2018 Found this one, which is nice. ? highlight_string("<?php\n\$data =\n" . var_export($data, true) . ";\n?>"); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.