[PHP] question about making modules

2007-09-01 Thread Mark
Hey,

i've been trying alot to make php modules (php based.. not real
modules for php in c) but i can't get it working.

Here is a sample file:

?php
class moduletest
{
function text()
{
return moduletestbr /;
}
}

class test_moduletest extends moduletest
{
function text()
{
return test_moduletestbr /;
}
}

$test = new moduletest;
$test2 = new test_moduletest;

echo $test-text();
echo $test2-text();
?

Now what you get when running this file:
moduletest
test_moduletest

That's logical and not the problem
The issue is that i want the test_moduletest class to overwrite
functions in moduletest but without the need for me to call the class
again.

So the result i want with $test-text(); == test_moduletest
and $test must initialize the moduletest class!! not the test_moduletest class.

I want to use this as a (obvious) module system so that others can
extend the base class with more advanced features or improve existing
features by overwriting them.

i did found a place where this is being done: ADOdb Lite but i can't
find out how that script is doing it..

Any help with this would be greatly appreciated

Thanx,
Mark.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] question about making modules

2007-09-01 Thread Robert Degen
Maybe you should deal with some things like

* Plugin-Architecture
* Extension Points
* States !?

A look at wikipedia might give most information you need.

Regards
rob


On Sa, Sep 01, 2007 at 11:23:31 +0200, Mark wrote:
 Hey,
 
 i've been trying alot to make php modules (php based.. not real
 modules for php in c) but i can't get it working.
 
 Here is a sample file:
 
 ?php
 class moduletest
 {
 function text()
 {
 return moduletestbr /;
 }
 }
 
 class test_moduletest extends moduletest
 {
 function text()
 {
 return test_moduletestbr /;
 }
 }
 
 $test = new moduletest;
 $test2 = new test_moduletest;
 
 echo $test-text();
 echo $test2-text();
 ?
 
 Now what you get when running this file:
 moduletest
 test_moduletest
 
 That's logical and not the problem
 The issue is that i want the test_moduletest class to overwrite
 functions in moduletest but without the need for me to call the class
 again.
 
 So the result i want with $test-text(); == test_moduletest
 and $test must initialize the moduletest class!! not the test_moduletest 
 class.
 
 I want to use this as a (obvious) module system so that others can
 extend the base class with more advanced features or improve existing
 features by overwriting them.
 
 i did found a place where this is being done: ADOdb Lite but i can't
 find out how that script is doing it..
 
 Any help with this would be greatly appreciated
 
 Thanx,
 Mark.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Und komm, Du brauchst nur einen Baum
um 1000 Streichhölzer herzustellen.
Aber Du brauchst nur einen Streichholz
um 1000 Bäume abzubrennen.
Meine Güte wer soll das denn jetzt verstehen?
Ganz egal, komm wir bleiben noch etwas länger.
Die Bedeutung zahlt ja immer der Empfänger

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php