I have a class (crypt) that helps me encrypt, decrypt. Then, another class (sess) for session starting, restricting and protecting pages. Then, another class (db) for storing session variables, sometimes by encryption like login time, logout time, server referrer etc. Now, with all this, how do I gain access to the three classes different functions in each of those classes as I can only extend one? The Crypt class is just helping to encrypt,I need it in almost every other class.furthermore, I know this questiön has been so answered that its becoming rhetoric but my main enquiry is the 'safest' method.
the way i do it is with a model class, which is used to call references to database, session and crypt classes, does the method calls, gets values back, and processes business logic, then returns the data to view.
simply put, your website should be:
root
-assets
--css
--img
--js
-modules
--home_page
--register_page
--login_page
-includes
--session_class
--crypt_class
--database_class
index
go go go
If you are using PHP 5.4, you can try to implement your commonly subclassed classes as traits instead.
I've solved it.I used-CLASS db Extends Crypt,then CLASS Sess Extends db.The funny part is db functiöns wön't work in Sess Class unless I use a :New Db;then $db->mylog() but for the Crypt class works through Parent::encrypt().funny!its like it jumped a step.Probably because I used Parent::encrypt() in the __construct function of Db.Its rough,but I know I didn't break things.