Jump to content

Class Includes returning Non-Objects (File Structure Problem)


electricshoe

Recommended Posts

I'm building an application that pulls in other applications in the document, and I'm having a bit of a file structure problem calling in classes with includes.

 

I'm a huge noob with file structure and using classes.

 

The problem exactly is that oscommerce is in a separate directory than the main script.

 

The index builds out a file, which includes all of the oscommerce header stuff, then custom template things, and then includes the body of the oscommerce. When I run a simplified version of the script in the root folder of the oscommerce installation it works fine.

 

But when I run oscommerce in a different folder and include the files into the script it breaks and gives me a

"Call to a member function display_price() on a non-object in filepath/file.php on line 33"

 

Is there anyway to get around this? Because I'm going to be cramming a lot of applications together in this script and I want each one to be in a separate folder and I include them into the script that runs in the root directory.

 

Currently the file structure looks like this:

 

root :: mainscript

root/modules :: custom modules

root/modules/include :: custom includes

root/modules/store/ :: oscommerce

root/modules/anyotherapp/  :: any other application i may want to include

 

so the script references files in different folders and includes them all into the main page builder. What can I do, I'm completely clueless here and having a hard time pinning down a tutorial that covers this.

 

Thanks in advance, I appreciate your help A LOT  ;D

I figured out exactly what the problem is, the file includes are coming in through functions and this is destroying their ability to do classes.

 

I'm gonna close this one and ask in the general php forum. Feel free to delete this post.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.