Categories

Featured templates

Joomla 2.5.x. How to deal with "Fatal error: Cannot redeclare class Mobile_Detect…"

Ryan DeWitt September 17, 2013
Rating: 5.0/5. From 3 votes.
Please wait...

This tutorial shows how to get rid of the Cannot redeclare class Mobile_Detect error.

1. The following error may appear on itemform page (when you add or edit item):

Fatal error: Cannot redeclare class Mobile_Detect in /templates/theme###/includes/mobile_detect.php

2. In order to get rid of the issue you need to edit templates/theme###/html/com_k2/default/itemform.php file. There you need to replace

require_once ($includesPath);

with

if(!class_exists('Mobile_Detect')){
  require_once ($includesPath);
}

3. Replace original file with modified one.


Joomla Web Templates
This entry was posted in Joomla! Tutorials and tagged 2.5, Cannot, error, fix, joomla, Mobile_Detect, redeclare. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket