Yii Framework Forum: change layout for admin? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

change layout for admin? Rate Topic: -----

#1 User is offline   mech7 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 220
  • Joined: 26-March 09

Posted 14 September 2009 - 08:31 AM

Is there anyway to check if the controller comes from an admin directory? so i can change the layout in a base controller ?
0

#2 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,376
  • Joined: 17-January 09
  • Location:Russia

Posted 14 September 2009 - 10:23 AM

Yes, sort of. Use AdminController as a base for admin functionality and FrontendController for everything else.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#3 User is offline   phpdevmd 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 73
  • Joined: 16-April 09

Posted 14 September 2009 - 02:50 PM

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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users