xoops forums

hervet

Friend of XOOPS
Posted on: 2009/8/8 17:08
hervet
hervet (Show more)
Friend of XOOPS
Posts: 2267
Since: 2003/11/4
#21

Re: PHP-Debugging without XOOPS

Quote:

frankblack wrote:
V1.3 is released

This is really the best enhancement for XOOPS developpers !

kaotik

Just can't stay away
Posted on: 2009/8/8 17:19
kaotik
kaotik (Show more)
Just can't stay away
Posts: 861
Since: 2004/2/19
#22

Re: PHP-Debugging without XOOPS

I've been tring to do the following:
Assume you want to log a variable you just have to write the following:
$firephp->log($yourvariable);
I've followed the previous steps and have firephp console open, where do I see my variable?
Thanks

frankblack

Just can't stay away
Posted on: 2009/8/8 17:21
frankblack
frankblack (Show more)
Just can't stay away
Posts: 830
Since: 2005/6/13
#23

Re: PHP-Debugging without XOOPS

Quote:
This is really the best enhancement for XOOPS developpers !


Feels like an accolade to hear this from you. Really! I admire your whole work, so this compliment makes me feel proud.

But I am not quite satisfied, because of some quirks like uncaught exceptions thrown inside XOOPS, which I can't track down.

Inside Frameworks/FirePHPCore I kept the original firephp class, if you want to revert getting exceptions caught. There are even PHP 4 classes in it, but I wasn't interested to write docs for them as well.

frankblack

Just can't stay away
Posted on: 2009/8/8 17:28
frankblack
frankblack (Show more)
Just can't stay away
Posts: 830
Since: 2005/6/13
#24

Re: PHP-Debugging without XOOPS

Quote:

I've been tring to do the following:
Assume you want to log a variable you just have to write the following:
$firephp->log($yourvariable);
I've followed the previous steps and have firephp console open, where do I see my variable?
Thanks


Hmm, my docs are a bit incomplete. First of all you have to activate "console" and "network" on the Firebug console. Logging your own variables in your modules need some extra.

I assume you have a header.php or anything like this getting included in every file you use?

Add the following code to your header.php:
require_once XOOPS_ROOT_PATH.'/Frameworks/FirePHPCore/FirePHP.class.php';
$firephp FirePHP::getInstance(true);
$firephp->registerErrorHandler(false);


Add this now to your file where you want the variable to be logged:
$firephp->log($yourvariable);


If used inside a function you have to add global $firephp; of course.

This should do the trick. You see the logs under the tab console.

kaotik

Just can't stay away
Posted on: 2009/8/8 17:50
kaotik
kaotik (Show more)
Just can't stay away
Posts: 861
Since: 2004/2/19
#25

Re: PHP-Debugging without XOOPS

Sorry about nagging, I folowed your previous steps.
here's my code:
<?php
include '../../mainfile.php';
require_once 
XOOPS_ROOT_PATH.'/Frameworks/FirePHPCore/FirePHP.class.php';
$firephp FirePHP::getInstance(true);

include 
XOOPS_ROOT_PATH.'/header.php';

$hello='betty boop';

$firephp->log($hello);

echo 
'testS';

include 
XOOPS_ROOT_PATH.'/footer.php';
?>


and here's a screen capture of my firebug. Where can I see my var $hello ?

frankblack

Just can't stay away
Posted on: 2009/8/8 17:54
frankblack
frankblack (Show more)
Just can't stay away
Posts: 830
Since: 2005/6/13
#26

Re: PHP-Debugging without XOOPS

Make sure Net and Console are activated. There is besides both a small triangle. Click this small triangle you'll get a pulldown where you can activate Net or Console. I see on your image that Net is not activated. The logs you'll see under the tab Console.

Did I mention that I am a bad teacher? Or doc writer?

kaotik

Just can't stay away
Posted on: 2009/8/8 18:04
kaotik
kaotik (Show more)
Just can't stay away
Posts: 861
Since: 2004/2/19
#27

Re: PHP-Debugging without XOOPS

It works!!! Wow, this looks very promising!
I should have been using something like this for a long time, would have saved me all those print_r()

kaotik

Just can't stay away
Posted on: 2009/8/8 18:05
kaotik
kaotik (Show more)
Just can't stay away
Posts: 861
Since: 2004/2/19
#28

Re: PHP-Debugging without XOOPS

Thanks frankblack for this great work!

Mamba

Moderator
Posted on: 2009/8/8 22:31
Mamba
Mamba (Show more)
Moderator
Posts: 10873
Since: 2004/4/23
#29

Re: PHP-Debugging without XOOPS

Quote:
Thanks frankblack for this great work!

I second that! Awesome work!

And very much needed for XOOPS developers!
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

frankblack

Just can't stay away
Posted on: 2009/8/8 22:47
frankblack
frankblack (Show more)
Just can't stay away
Posts: 830
Since: 2005/6/13
#30

Re: PHP-Debugging without XOOPS

Not I did the awesome work, but the guys from Firefox, FireBug and FirePHP. I just made the quick and dirty hack. I am not fishing for compliments. Everyone else could have done this. This solution was born out of my own frustration that xajax and XOOPS were confusing each other with their debug methods.

So this was a waste product of my efforts on the work at my module. There are about two other waste products that could lead to other modules if I had the time. Maybe one day ...