Get name of parent method and classf |
Hello, i'm writing a log script which basicaly logs the user actions and stores them in the database for further analysis. Its a very basic script but it does the job. However i need a way to get the name of the parent methon which the log action is called and the class. The standard php get_parent_class returns CI_Controller instead on the class name i want.
For example if i have something like this: PHP Code: class MyClass extends CI_Controller {
You sholdn't use get_called_class ?
or you can declare you MY_Controller class in application/core with some fields like $class_name , ... and user it as parent of your controllers instead of CI_controller, so you can initialize that fields in __construct function for each subClass.
ressan.ir
CI is nice
What about segment(2) for the class name and segment(3) for the method name?
(06-13-2015, 09:03 AM)Wouter60 Wrote: What about segment(2) for the class name and segment(3) for the method name? That nice idea, but no so if custom route is enabled or routes are remapped.
NexoPOS 2.6.2 available on CodeCanyon.
Pretty much everything you suggested works. I will probably go with the segments
|
Welcome Guest, Not a member yet? Register Sign In |