|
-
February 7th, 2007, 01:58 AM
#2
Re: How to add plugin functionality to a class?
hi,
have look at the overloadind of php.
You can define a "magic" __call function, with than gets called in case you call a member function which does not exist.
(How to use __call exactly depends on your php version)
Within these function you could then execute code.
Well, to inject a variable, you could also use the magic __set and __get functions but you can also simply do somehting like $this->bla = "bla";
You just have to change your include to
Code:
$this->name = 'Class Name 2';
no function... as this opens a new scope and $this is not known there.
Well, or.. you use the traditional approach of extending classes and instanciate the class you want...
hope i could point the direction
there are 10 kinds of people. those who understand binary and those who don't...
rate a post if you find it usefull, thx
check out my Firefox/Mozilla Extension: http://urlparams.blogwart.com/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|