alkahest Posted October 1, 2013 Posted October 1, 2013 Is there a way to do a var_dump() in PW without getting a massive incomprehensible array returned? The amount of data that's inside the object is so extensive that it often crashes the browser. Is there a wrapper function that's just for debugging?
Wanze Posted October 1, 2013 Posted October 1, 2013 Depends on the variable you put in var_dump Can you tell what do you want to achieve, debug?
alkahest Posted October 1, 2013 Author Posted October 1, 2013 Well, I have something as simple as a list of US states and their children (which are Schools). The US states just have a title, as do the Schools. I have looped through all the states and split them into two arrays for display purposes. All I want to do is var_dump the array that contains the objects, but PW spits out an insane 20 page novel about the contents of the states and their children.
Pete Posted October 1, 2013 Posted October 1, 2013 You can do this on any PageArray: echo $yourresults->getArray(); Taken from here: http://cheatsheet.processwire.com/ (you'll need to click on "advanced" at the top to see this though.
alkahest Posted October 1, 2013 Author Posted October 1, 2013 So, when I try: $state_set = $pages->find('template=state'); echo $state_set->getArray(); I get Array(); as the output. If I try: var_dump($state_set->getArray()); I get Proust.
diogo Posted October 1, 2013 Posted October 1, 2013 You can also use Soma's http://modules.processwire.com/modules/chrome-php-logger/ to have all the info in more organized way 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now