I'm new to Magento 2.

Fatal error: Class 'Mage' not found in \vendor\magento\module-theme\view\base\templates\root.phtml on line 23

Can anybody tell me how to solve this?

  • Please add more details, you should add more code lines. – Khoa TruongDinh Aug 2 '16 at 6:00
  • plz show your root.phtml file tomore debug – Rakesh Jesadiya Aug 2 '16 at 6:07

Mage is deprecated in Magento2.

Magento2, not using factory Patten types like Mage::getModel ,Mage::getsingleton() etc

It now uses the class nameSpace concept

To learn more about how to use ObjectManager in Magento 2, checkout these links:


It looks like the theme you installed is not compatible with Magento 2.
Aparently it has a Mage::...() call in one of the files.


in magento 2 call the model any where

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$model = $objectManager->create('\Namespace\Modulename\Model\Modulename');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.