admin vs public css

Jake Bunce

Well-known member
I currently do this in 1.2 to know if I'm in admin versus public:

Rich (BB code):
			$isAdmin = (   XenForo_Application::getFc()->getDependencies()->getBaseViewClassName() == 'XenForo_ViewAdmin_Base'   );
			$isPublic = (   XenForo_Application::getFc()->getDependencies()->getBaseViewClassName() == 'XenForo_ViewPublic_Base'   );

			if ($isPublic)
			{
				$template->addRequiredExternal('css', 'nat_public_css');
			}
			else if ($isAdmin)
			{
				$template->addRequiredExternal('css', 'nat_admin_css');
			}

What other methods do people use?

Some older addons are encountering conflicts with NodesAsTabs because it uses XenForo_Application::getFc() which is new to 1.2. So I want to use a different method to avoid causing errors in other addons.
 
PHP:
            if ($template instanceof XenForo_Template_Public)
            {
                $isPublic = true;
            }
            else
            {
                $isAdmin = false;
            }

Should do it :)
 
Back
Top Bottom