1

I have a local, staging and production setup (Craft 2.6.3011). My local site is having a problem with transforms that seems to be related to the mobile detect plugin (I am using Mikkel Rummelhoff's Detect Plugin).

The Detect code I'm using in my template is: {% set isMobile = craft.detect.isMobile ? '1' : '0' %}

The home page has four images that 404 with transform urls. If I look at the response I see the following errors:

Twig_Error_Runtime
Neither the property "detect" nor one of the methods "detect()", "getdetect()"/"isdetect()" or "__call()" exist and have public access in class "Craft\CraftVariable" in "_includes/header.html" at line 102. (/mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php:660)

#0 /mylocaldevpath/craft/app/etc/templating/BaseTemplate.php(64): Twig_Template->getAttribute(Object(Craft\CraftVariable), 'detect', Array, 'any', false, false)
#1 /mylocaldevpath/craft/storage/runtime/compiled_templates/f6/f671e04469d81f0dfda61111136d722fb954e341b7543ce8baa919e43343b4ae.php(244): Craft\BaseTemplate->getAttribute(Object(Craft\CraftVariable), 'detect', Array)
#2 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_81873f0b87bd6a678f4bf938ed6516d87c5b9a4339fc9d6dfcf337b2f069a6f9->doDisplay(Array, Array)
#3 /mylocaldevpath/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template->displayWithErrorHandling(Array, Array)
#4 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate->displayWithErrorHandling(Array, Array)
#5 /mylocaldevpath/craft/storage/runtime/compiled_templates/12/129e9e7cc1b6a86df018442a329dd1d6e1f7d9c31cb94b7b01ae6cfeff6f2ebd.php(198): Twig_Template->display(Array)
#6 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_11ee36b35600746e068e6dd5ace4c2797e2ec35ca7d474eb36bb37f7250bd707->doDisplay(Array, Array)
#7 /mylocaldevpath/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template->displayWithErrorHandling(Array, Array)
#8 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate->displayWithErrorHandling(Array, Array)
#9 /mylocaldevpath/craft/storage/runtime/compiled_templates/fe/fe5ea1b61c6d52fa030f7f1d75b2b4568bab6dfe912af74613b657eed595f6fe.php(43): Twig_Template->display(Array, Array)
#10 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_455d61df868203e0a6669f803e3d1b9e9a10f94ed6abe1e14ec8e1bee9d1c1e1->doDisplay(Array, Array)
#11 /mylocaldevpath/craft/app/etc/templating/BaseTemplate.php(26): Twig_Template->displayWithErrorHandling(Array, Array)
#12 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php(403): Craft\BaseTemplate->displayWithErrorHandling(Array, Array)
#13 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Template.php(411): Twig_Template->display(Array)
#14 /mylocaldevpath/craft/app/vendor/twig/twig/lib/Twig/Environment.php(363): Twig_Template->render(Array)
#15 /mylocaldevpath/craft/app/services/TemplatesService.php(256): Twig_Environment->render('404', Array)
#16 /mylocaldevpath/craft/app/controllers/BaseController.php(74): Craft\TemplatesService->render('404', Array)
#17 /mylocaldevpath/craft/app/controllers/TemplatesController.php(213): Craft\BaseController->renderTemplate('404', Array)
#18 /mylocaldevpath/craft/app/framework/web/actions/CInlineAction.php(49): Craft\TemplatesController->actionRenderError()
#19 /mylocaldevpath/craft/app/framework/web/CController.php(308): CInlineAction->runWithParams(Array)
#20 /mylocaldevpath/craft/app/framework/web/CController.php(286): CController->runAction(Object(CInlineAction))
#21 /mylocaldevpath/craft/app/framework/web/CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#22 /mylocaldevpath/craft/app/framework/web/CWebApplication.php(282): CController->run('renderError')
#23 /mylocaldevpath/craft/app/framework/base/CErrorHandler.php(368): CWebApplication->runController('templates/rende...')
#24 /mylocaldevpath/craft/app/etc/errors/ErrorHandler.php(281): CErrorHandler->renderError()
#25 /mylocaldevpath/craft/app/framework/base/CErrorHandler.php(351): Craft\ErrorHandler->renderError()
#26 /mylocaldevpath/craft/app/framework/base/CErrorHandler.php(218): CErrorHandler->renderException()
#27 /mylocaldevpath/craft/app/etc/errors/ErrorHandler.php(145): CErrorHandler->handleException(Object(Craft\HttpException))
#28 /mylocaldevpath/craft/app/framework/base/CErrorHandler.php(131): Craft\ErrorHandler->handleException(Object(Craft\HttpException))
#29 /mylocaldevpath/craft/app/framework/base/CApplication.php(750): CErrorHandler->handle(Object(CExceptionEvent))
#30 [internal function]: CApplication->handleException(Object(Craft\HttpException))
#31 {main}

If I remove the plugin code from my template and rename the 'detect' plugin folder then I just get the 404s with no useful response. I have checked permissions for assets (macOS - MAMP Pro) and these seem fine. I can see the source images for the transforms but it always 404s the transform url. This is a multilingual site in 9 languages and works 100% perfect apart from this.

Any ideas?

  • Can you edit your answer and include the snippet of Twig code that you're using to do the "detecting"? Looks like it's in _includes/header.html... – Jalen Davenport Feb 26 '18 at 14:36
  • Did you install the plugin on all your environments? Because it says it could not find the plugin. And of course as already said we need your code – Robin Schambach Feb 26 '18 at 15:09
  • Sites been deployed for over a year. Staging is working fine. It's just locally that i see this problem. Plugin is there and exists. Updated question with plugin code – joomkit Feb 26 '18 at 15:12
1

Such a klutz: My local basePath was incorrect. Detect plugin was a red-herring.

All solved

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.