Closed wendaliu closed 9 years ago
HE, no sorry there's nothing like that. But you could build it like this: Create a static method that gives back the controller name, like Helper::getControllerName()
, the according class could look like this (quick & dirty code, not tested):
class Helper {
static function getControllerName()
{
// split URL
$url = trim($_GET['url'], '/');
$url = filter_var($url, FILTER_SANITIZE_URL);
$url = explode('/', $url);
return $url[0];
}
}
Maybe you could even do this inside the Application class, like Application::getXXX
, I'm not sure.
Where would I create this class?
I was wondering if there is already a built in function to get the current controller or current view NAME.I want to get thse so that I can determine in the header template which menu item is active and so I can set it's css to active.