[contact-form-7 id="24078" title="Feedback EN"]

Featured templates

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

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.