I have a 'view.php' file like this and i have a render()
method in it.
class view {
public function render(){
require 'views/header.php';
require "views/??/??.php";// ??/?? should be name of class/ method in which render() method is called , is their some property for that like get_class or something else. in below 'home.php' ??/?? should be home/index.
require 'views/footer.php';
}
}
and i have a controller home.php
like this.
<?php
class home{
public $view;
function __construct{
$this->view = new view;
}
public function index(){
$this->view->render();// in this case ??/?? should be home/index
}
}
?>
I want to get the name of the class and method in which render()
method is been called. For example I try in render() method get_class
but it didn't work because it will give the name of the class where the function is defined i.e in above example if i use ??= get_class
it will give class name view
Yes I can use arguments in render()
but then in every controller i have to define the arguments, But is their any way so that i can do it without using arguments.? Thanks in advance