My brain hurts. I’ve been battling this for over a day now and am no closer to a solution. I know it’s not policy to review/debug third-party scripts, but I could use some illumination as it appears to be EE’s handling of the include in question that is problematic.
The code I’m using is the Vogoo LIB, available here. It comprises a core include, plus a couple of supplementar ones depending on the required functionality.
The template code is:
<?
error_reporting(E_ALL);
include($_SERVER['DOCUMENT_ROOT']."/vogoo/vogoo.php");
include($_SERVER['DOCUMENT_ROOT']."/vogoo/items.php");
$vogoo_check = $vogoo->connected;
if($vogoo_check)
{
echo "heya";
$ret = $vogoo_items->member_get_recommended_items(1);
print_r($ret);
} else {
generate_error(0,"Vogoo DB not connecting");
}
?>
Which produces the following errors:
Notice: Trying to get property of non-object in /home/dir/public_html/vogoo/items.php on line 90
Fatal error: Call to a member function sql_query() on a non-object in /home/dir/public_html/vogoo/items.php on line 90
I’ve seen some talk on the boards here about variables and scope setting, but frankly am unsure where to start. I’ve confirmed this is working properly just in native PHP docs on the server, so it is something to do with how EE is resolving…. something.
Moved to Modules: Technical Assistance by Moderator
Thanks Greg. I have in fact tried hardcoding all path statements and it has no effect at all. I’m convinced it has something to do with how globals are set, but it’s beyond my skillset to properly determine unfortunately.
Edit: have also noticed the PHP script in question is setting a $db var for accessing its database functions. Could this conflict with EE’s own DB class?
I don’t know if this helps at all but I once had a problem with a PHP script running from inside ExpressionEngine as an include and found out in the end that the variables inside the included PHP file needed to all be set to global variables or else I had all sorts of problems. It was above me how to do this but the developers of the script did this for me and then it worked fine. Not sure if that is what is happening in your case though.
Best wishes,
Mark
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.