Hello folks,
So, I have decided to start a small CMS, for learning purposes.
It's going pretty smooth, but I decided to implement a hook system, so you can extend the CMS without touching the core files.
I have the following idea: To create a hook, a person creates a php file in the hooks folder, and simply redeclare every method of my classes he/she wants.
Example:
I have a class called Users that has a method called showUser, like the following:
class Users {
function showUser($id) {
echo "Welcome ". $id;
}
}
then, in the hooks folder, a file called Users_leavePlease.php:
function showUser($id) {
echo "Please leave " . $id;
}
The problem is...php won't allow it. It gives me the function redeclare error if I include the php file.
Any ideas how can I make this work?
thanks,
bl00dshooter.