how to display contents of $data in profiler ? |
[eluser]Flemming[/eluser]
It would be useful for me to be able to extend the profiler class so that it will display the contents of $data. I've had a poke around in the profiler but it doesn't seem to know what $data is. Can anyone suggest how I could achieve this?
[eluser]Wittner[/eluser]
What do you mean by $data ? are you talking about a situation similar to the following?: Code: $data['pageHeading'] = 'My home page'; ... where you would like to see the value of $data echoed to the screen for debugging?
[eluser]Flemming[/eluser]
exactly! I would like to always be able to see (when I have the profiler enabled) what $data contains, rather than have to echo it to the view whenever I want to see it
[eluser]jedd[/eluser]
You could extend MY_Profiler. Have a read of [url="http://ellislab.com/forums/viewthread/133671/"]this thread[/url] and grab n0xie's session-data-enabled MY_Profiler script - useful in itself, but also as an example for what you can do.
[eluser]Flemming[/eluser]
Thanks for that Jedd - very useful! But I'm still none-the-wiser as to how to display the contents of $data! It's an undefined variable, so I tried $this->CI->data but that's an undefined property. As you can probably tell I'm stabbing around in the dark...
[eluser]John_Betong[/eluser]
[quote author="flemming" date="1256930053"]Thanks for that Jedd - very useful! But I'm still none-the-wiser as to how to display the contents of $data! It's an undefined variable, so I tried $this->CI->data but that's an undefined property. As you can probably tell I'm stabbing around in the dark...[/quote] http://ellislab.com/forums/viewthread/130302/#653952 Try fred(...) in the link above. Not only but also displays booleans, integers, floats, strings, arrays and objects - the answer to all your prayers? edit: creating link instead of a string which occurs intermittently for some unknown reason? Also added a display for an object.
[eluser]Flemming[/eluser]
thanks John - I'll take a look at that, sounds very promising!
[eluser]Flemming[/eluser]
John, this may be a very dumb question but how on earth does fred() know what I want it to process? In your example you pass in Code: $data='usage: fred("any type of data")', $data_name='missing_$data_name'
[eluser]John_Betong[/eluser]
[quote author="flemming" date="1257194083"]John, this may be a very dumb question but how on earth does fred() know what I want it to process? In your example you pass in Code: $data='usage: fred("any type of data")', $data_name='missing_$data_name' Code: // copy and paste this into your view The second parameter is optional but useful if you pass __FILE__ or __LINE, etc |
Welcome Guest, Not a member yet? Register Sign In |