Thx for the reply.
Yes, what you're saying is also what I read in OOP literature and it makes much sense indeed.
However, I do need a way for making some objects transportable:
this is what I have so far:
A mysql class: handles the connection and mysql operations
a core class: contains all "low level" functions and does the basic init of the script environment (like loading config, load skin, load words, etc...) and loads a module specified in the url (eg: http://www.mydomain.com/index.php?module=news )
a display class: loads a specified template and replaces the custom tags with html from the skin templates and prints to the browser.
a session class: does the user authentication and session creation.
a skin class: loads the html template bits specific for a module.
A goup of modules that use all of the above classes, specified by module=news in the url...
Inside a module, this would result in code like this:
function my_function()
{
global $input, $core, $sess, $conf, $db;
$db->query( 'SELECT * FROM tablename where id='.$input['topic_id'] );
// do somthing with it...
}
The exemple above illustrates why I was thinking about an array so that I only need to say "global $ZAPI", or am I approaching it totaly wrong and is there a better way for this? 🙂
My goal is to make a script that serves as an API and a "plugin system" which does all the universal things a php script needs to do.
The modules would be the "plugins" that expand the script's abilities so that it can be a blog, gallery, board, or anything you plug in it.