|
|
|
|
jomtubecom
()
|
|
||||||||||||
|
hello,
i went through all the posts here as i am trying to learn php and mysql as i have component and developed for joomla 1.5. and stumbled upon your firephp a day or so ago... Then researched through the documentation as read the Joomla 1.5x framework plugin that was posted on the JED but as the directions were in Italian.. Plus its the older version and i see problems in the PLUGIN with the paths.. anyways after i read more i just put the FIREPHP directory into my Component and loaded in correctly then the Joomla plugins i looked at.. Plus i just want it to debug my project for now specifically.. So I got everything running with some trial and error but tested most of the things you have posted on the tutorial page.. QUESTION 1 I see there are 3 ways to call FIREPHP that you posted.. Is there one way thats better that the other or its preference.. As you mention that OOP seems to be the best for future changes?? But the Procedural way is easier for me to understand as thats the way i call the classes and methods in Joomla 1.5x.. so does it matter? require_once('FirePHPCore/FirePHP.class.php'); function test() { $firephp = FirePHP::getInstance(true); $firephp->info('Info Message'); } test(); Option 2: require_once('FirePHPCore/fb.php'); function test() { fb('Info Message','INFO'); } test(); Option 3: require_once('FirePHPCore/fb.php'); function test() { FB::send('Info Message','INFO'); } test(); ================================================ QUESTION 2 I have a list VARIABLES that i want to log to the CONSOLE which works when I add the FIREPHP methods directly in the my own FUNCTION i am trying to debug which is its own .php file.. I have created my own add-on plugins for my Joomla Extension that i am describing above. I have a many variables that i am logging.. Each of my Joomla Plugins basically has identical variables so the FIREPHP logging will be the same for each one.. So is there a way the I can add or load the FIREPHP methods i need from a FUNCTION, METHOD, CLASS, etc? from outside file so all the methods are not located in the ACTUAL PLUGIN.. right now for example this is the FIREPHP LOGS i am using in one FUNCTION which works logs correctly in the FIREBUG CONSOLE.. include_once(JPATH_ROOT.DS.'components'.DS.'com_jomtube'.DS.'libraries'.DS.'FirePHPCore'.DS.'fb.php'); $firephp = FirePHP::getInstance(true); $firephp->log($reqtype, 'reqtype'); $firephp->log($pattern, 'pattern'); $firephp->log($video_type, 'videotype'); $firephp->log($remote_id, 'remoteid'); $firephp->log($url, 'url'); $firephp->log($titlecase, 'titlecase'); $firephp->log($pubdate, 'pubdate'); $firephp->log($scrapemethod, 'scrapemethod'); $firephp->log($debugMode, 'debugMode'); then it goes through some more code of my function then log the the variables again to see if they properly got the correct info $firephp->info('All The Variables Below Are in the $remotevideo Array'); $firephp->log($video_url, 'video_url'); $firephp->log($video_thumb, 'video_thumb'); $firephp->log($thumbs_array, 'thumbs_array'); $firephp->log($video_title, 'video_title'); $firephp->log($video_desc, 'video_desc'); $firephp->log($tags, 'tags'); $firephp->log($duration, 'duration'); $firephp->log($date_added, 'date_added'); $firephp->log($remote_id, 'remote_id'); $firephp->log($video_type, 'video_type'); $firephp->log($alias, 'alias'); $firephp->log($remote_author, 'remote_author'); FB::Trace(VideoDetails); MY QUESTION IS THIS??? hope you understand what i posted above :) .. but i want to put all of the above LOGGING METHODS not directly in my FUNCTION. So is there a way to do this as i tried to make an outside FUNCTION and call it from my plugin but all the VARIABLE SAY UNDEFINED as they are blank.. its something like this as i made a FUNCTION in my main CLASS that is JOOMLA EXTENSION. The i called the FUNCTION Below from the PLUGIN but all the variable where UNDEFINED. function ScrapeDetails(){ include_once(JPATH_ROOT.DS.'components'.DS.'com_jomtube'.DS.'libraries'.DS.'FirePHPCore'.DS.'FirePHP.class.php'); $firephp = FirePHP::getInstance(true); $firephp->log($reqtype, 'reqtype'); $firephp->log($pattern, 'pattern'); $firephp->log($videotype, 'videotype'); $firephp->log($remote_id, 'remoteid'); $firephp->log($urljson, 'urljson'); $firephp->log($titlecase, 'titlecase'); $firephp->log($pubdate, 'pubdate'); $firephp->log($scrapemethod, 'scrapemethod'); $firephp->log($debugMode, 'debugMode'); $firephp->info('All The Variables Below Are in the $remotevideo Array'); $firephp->log($video_url, 'video_url'); $firephp->log($video_thumb, 'video_thumb'); $firephp->log($thumbs_array, 'thumbs_array'); $firephp->log($video_title, 'video_title'); $firephp->log($video_desc, 'video_desc'); $firephp->log($tags, 'tags'); $firephp->log($duration, 'duration'); $firephp->log($date_added, 'date_added'); $firephp->log($remote_id, 'remote_id'); $firephp->log($video_type, 'video_type'); $firephp->log($alias, 'alias'); $firephp->log($remote_author, 'remote_author'); $firephp->trace('Trace Label'); } I read about SUBCLASS that you mentioned but do not know if that is the direction i need to go as i read it but i dont know.. Is this something i can add into the FIREPHP class??? So i am lost here. So this where i need help if its possible to call these method list from outside of the PLUGIN.. The reason is i want to leave the actual FIREPHP METHODS in the PLUGIN and try tomake it so that user(ADMIN) will only be able to see this for DEBUGGING. But i do I want to have all these methods inside the actual JOOMLA PLUGIN but a seperate file. Because i have 30 plugins they are using the same FIREPHP METHODS for each one.. So i can just call the file and it can be turned ON or OFF in the BACKEND for logging like you describe in your Directions. Thanks for any help... rick |
||||||||||||||
|
|
Christoph Dorn
()
|
|
||||||||||||
Use the procedural interface fb() for ad-hock debugging where you are working on specific logic. Use the OO interface if you plan on leaving the logging statements in and disabling them via a config option. It does not matter if you use the static interface or get a reference to the firephp object first. Your problem is that when you wrap your logging calls into an external function you loose the references to all the variables you want to log (that are only available within the plugin class). What you likely want to to is subclass the joomla plugin class, add a logging function with correct references to all the variables you need to log and then extend this class with your plugins. In your plugins you will now only need to call the function in the super class to log the variables. Christoph |
||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |