|
Posted by Tyno Gendo on 04/07/07 12:50
I'm writing a test "modular site". So far I have created an App class,
a Module Manager class and a couple of test modules.
The Manager looks in a directory called 'modules' and then for every
..php file is try to create a class of type <filename> minus the .php, so
eg. for testmodule.php it tries to create a class "testmodule" and puts
it into an array within the module manager called $_modules
Module Manager has a dispatch_message function which accepts an ID for
the type of message to send, which recurses through the modules in
$_modules and uses their ReceiveMessage function to send them the message.
example:
public function dispatch_message( $message_id ) {
foreach ( $this->_modules as $module ) {
$module->ReceiveMessage( $message_id );
}
}
This is all working well and good, the thing I'm wondering about is when
modules want to postback information, should i rely on module users
naming their form inputs specifically to their module, or should my app
(when register the modules) supply a module with a unique 'ident' that
the module writer should then check for in their code and all for in
their forms etc.
eg., should i force module writers to make forms as such:
<input type="text" name="<?phpecho $mymodules->ident()?>_username"
value="" />
How do these modular sites normally differentiate from one modules POSt
to anothers?
[Back to original message]
|