Is there anyway to check if the controller comes from an admin directory? so i can change the layout in a base controller ?
Is there anyway to check if the controller comes from an admin directory? so i can change the layout in a base controller ?
Yes, sort of. Use AdminController as a base for admin functionality and FrontendController for everything else.
I have used a simple class for Web3CMS
/**
* Manage Area
*/
class MArea
{
/**
* Check whether is backend.
* @return bool
*/
public static function backend()
{
return (bool)Yii::getPathOfAlias('backend');
}
/**
* Check whether is frontend.
* @return bool
*/
public static function frontend()
{
return !self::backend();
}
}
?>
I will commit these days, so you can download and install, but code above is probably self-explanatory.