{"id":30508,"date":"2013-09-17T06:53:23","date_gmt":"2013-09-17T10:53:23","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=30508"},"modified":"2017-08-16T10:48:05","modified_gmt":"2017-08-16T14:48:05","slug":"joomla-2-5-x-how-to-deal-with-fatal-error-cannot-redeclare-class-mobile_detect","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/joomla-2-5-x-how-to-deal-with-fatal-error-cannot-redeclare-class-mobile_detect.html","title":{"rendered":"Joomla 2.5.x. How to deal with &quot;Fatal error: Cannot redeclare class Mobile_Detect&#8230;&quot;"},"content":{"rendered":"<p><\/p>\r\n<p>This tutorial shows how to get rid of the Cannot redeclare class Mobile_Detect error.<\/p>\r\n<p>1. The following error may appear on itemform page (when you add or edit item):<\/p>\r\n<pre>Fatal error: Cannot redeclare class Mobile_Detect in \/templates\/theme###\/includes\/mobile_detect.php<\/pre>\r\n<p>2. In order to get rid of the issue you need to edit <strong>templates\/theme###\/html\/com_k2\/default\/itemform.php<\/strong> file. There you need to replace<\/p>\r\n<pre class=\"brush:php\">require_once ($includesPath);<\/pre>\r\n<p>with <\/p>\r\n<pre class=\"brush:php\">if(!class_exists('Mobile_Detect')){\r\n  require_once ($includesPath);\r\n}<\/pre>\r\n<p>3. Replace original file with modified one.<\/p>\r\n<p><br \/>\r\n<\/p>\r\n<p><\/p>\r\n<div class=\"inline-banner\">\r\n<a href=\"https:\/\/www.templatemonster.com\/cart.php?addOffer=587\">\r\n<img src=\"\/help\/files\/banners\/inline\/Banner-1-(500-x100).jpg\" \/>\r\n<\/a>\r\n<\/div>","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to get rid of the &#8220;Cannot redeclare class Mobile_Detect&#8221; error.<\/p>\n","protected":false},"author":39,"featured_media":30510,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[724],"tags":[1149,1545,691,1373,483,1547,1546],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/30508"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=30508"}],"version-history":[{"count":1,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/30508\/revisions"}],"predecessor-version":[{"id":82788,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/30508\/revisions\/82788"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/30510"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=30508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=30508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=30508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}