The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Hooks inside classes
Hey all,
I'm writing a fairly advanced plugin that i want to be 'extensible' by other people after it's released. I therefore want to include a hook inside the class i'm writing which can be used to add additional functions. I've created the hook with the xml file, and am now trying to add the hook to the class. I've tried adding it to the class, outside of any functions, but i get errors, so I'm assuming the hook would have to go inside a function. Is it possible to do what i want? I want other plugins to add functions within my code by 'inserting them' at the hook. Should I put it inside the constructor? Or is it a lost cause? Ollie |
#2
|
|||
|
|||
.....but i get errors.....
It might help if you show the errors. |
#3
|
||||
|
||||
You can't add anything inside the class (outside of functions) that isn't related to the class. Take a look at the aggregate_methods() function but note that it's experimental and was dropped in PHP 5
|
#4
|
|||
|
|||
I've found a sort of way of doing it... it seems a bit dodgy though.
I've put the hook inside the constructor, and it does work, but the functions get added globally, and do not become members of the class.. for example you have to call them using just myFunctionName() and not $this->myFunctionName() Can anyone think of a better solution or am I stuck with using that? :P Ollie |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|