Hallo,
wir haben eine Facebook-Werbeanzeige geschaltet, und hierzu wollen wir das sog. "Zählpixel" von Facebook integrieren. So sieht der allgemeine Teil aus:
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'XXXXXXXXXXXXXXXXXXXX'); // Insert your pixel ID here.
fbq('track', 'PageView');
fbq('track', 'Purchase');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=XXXXXXXXXXXXXXXXXXXX&ev=PageView&noscript=1"
/></noscript>
<!-- DO NOT MODIFY -->
<!-- End Facebook Pixel Code -->
Dieses Script soll im Head der Seite platziert werden. Wunderbar, hierfür steht ja in der fontend/index/header.tpl der Block frontend_index_header_javascript_tracking direkt vor dem schießenden Head-Tag zu Verfügung. Also rein damit, Theme neu kompiliert und zack:
Syntax Error in template "/pfad/zum /shop/shopware/themes/Frontend/xxx/frontend/index/header.tpl" on line 4 "!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?" - Unexpected ".", expected one of: "","" , ")" in engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 657
Stack trace:
#0 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3144): Smarty_Internal_TemplateCompilerBase->trigger_template_error()
#1 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3209): Smarty_Internal_Templateparser->yy_syntax_error(59, '.')
#2 engine/Library/Smarty/sysplugins/smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(59, '.')
#3 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(192): Smarty_Internal_SmartyTemplateCompiler->doCompile('\n <!-- Faceb...')
#4 engine/Library/Smarty/sysplugins/smarty_internal_compile_block.php(197): Smarty_Internal_TemplateCompilerBase->compileTemplate(Object(Smarty_Internal_Template))
#5 engine/Library/Smarty/sysplugins/smarty_internal_compile_block.php(255): Smarty_Internal_Compile_Block::compileChildBlock(Object(Smarty_Internal_SmartyTemplateCompiler), 'frontend_index_...')
#6 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(465): Smarty_Internal_Compile_Blockclose->compile(Array, Object(Smarty_Internal_SmartyTemplateCompiler), Array, NULL, NULL)
#7 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(249): Smarty_Internal_TemplateCompilerBase->callTagCompiler('blockclose', Array, Array)
#8 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(2493): Smarty_Internal_TemplateCompilerBase->compileTag('blockclose', Array)
#9 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3101): Smarty_Internal_Templateparser->yy_r58()
#10 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3201): Smarty_Internal_Templateparser->yy_reduce(58)
#11 engine/Library/Smarty/sysplugins/smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(10, '\n</head>\n')
#12 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(192): Smarty_Internal_SmartyTemplateCompiler->doCompile('<head>\n{* Http-...')
#13 engine/Library/Smarty/sysplugins/smarty_internal_compile_include.php(146): Smarty_Internal_TemplateCompilerBase->compileTemplate(Object(Enlight_Template_Default))
#14 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(475): Smarty_Internal_Compile_Include->compile(Array, Object(Smarty_Internal_SmartyTemplateCompiler), Array, NULL, NULL)
#15 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(249): Smarty_Internal_TemplateCompilerBase->callTagCompiler('include', Array, Array)
#16 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(2388): Smarty_Internal_TemplateCompilerBase->compileTag('include', Array)
#17 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3101): Smarty_Internal_Templateparser->yy_r36()
#18 engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3201): Smarty_Internal_Templateparser->yy_reduce(36)
#19 engine/Library/Smarty/sysplugins/smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(10, '\n')
#20 engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(192): Smarty_Internal_SmartyTemplateCompiler->doCompile('{block name="fr...')
#21 engine/Library/Smarty/sysplugins/smarty_internal_template.php(187): Smarty_Internal_TemplateCompilerBase->compileTemplate(Object(Enlight_Template_Default))
#22 engine/Library/Smarty/sysplugins/smarty_internal_templatebase.php(155): Smarty_Internal_Template->compileTemplateSource()
#23 engine/Library/Enlight/View/Default.php(274): Smarty_Internal_TemplateBase->fetch()
#24 engine/Library/Enlight/Controller/Plugins/ViewRenderer/Bootstrap.php(216): Enlight_View_Default->render(Object(Enlight_Template_Default))
#25 engine/Library/Enlight/Controller/Plugins/ViewRenderer/Bootstrap.php(242): Enlight_Controller_Plugins_ViewRenderer_Bootstrap->renderTemplate(Object(Enlight_Template_Default))
#26 engine/Library/Enlight/Controller/Plugins/ViewRenderer/Bootstrap.php(136): Enlight_Controller_Plugins_ViewRenderer_Bootstrap->render()
#27 engine/Library/Enlight/Event/Handler/Default.php(91): Enlight_Controller_Plugins_ViewRenderer_Bootstrap->onPostDispatch(Object(Enlight_Controller_ActionEventArgs))
#28 engine/Library/Enlight/Event/EventManager.php(214): Enlight_Event_Handler_Default->execute(Object(Enlight_Controller_ActionEventArgs))
#29 engine/Library/Enlight/Controller/Action.php(200): Enlight_Event_EventManager->notify('Enlight_Control...', Object(Enlight_Controller_ActionEventArgs))
#30 engine/Library/Enlight/Controller/Dispatcher/Default.php(523): Enlight_Controller_Action->dispatch('indexAction')
#31 engine/Library/Enlight/Controller/Front.php(223): Enlight_Controller_Dispatcher_Default->dispatch(Object(Enlight_Controller_Request_RequestHttp), Object(Enlight_Controller_Response_ResponseHttp))
#32 engine/Shopware/Kernel.php(179): Enlight_Controller_Front->dispatch()
#33 vendor/symfony/http-kernel/HttpCache/HttpCache.php(487): Shopware\Kernel->handle(Object(Enlight_Controller_Request_RequestHttp), 1, true)
#34 engine/Shopware/Components/HttpCache/AppCache.php(255): Symfony\Component\HttpKernel\HttpCache\HttpCache->forward(Object(Symfony\Component\HttpFoundation\Request), true, NULL)
#35 vendor/symfony/http-kernel/HttpCache/HttpCache.php(444): Shopware\Components\HttpCache\AppCache->forward(Object(Symfony\Component\HttpFoundation\Request), true)
#36 vendor/symfony/http-kernel/HttpCache/HttpCache.php(344): Symfony\Component\HttpKernel\HttpCache\HttpCache->fetch(Object(Symfony\Component\HttpFoundation\Request), true)
#37 engine/Shopware/Components/HttpCache/AppCache.php(178): Symfony\Component\HttpKernel\HttpCache\HttpCache->lookup(Object(Symfony\Component\HttpFoundation\Request), true)
#38 vendor/symfony/http-kernel/HttpCache/HttpCache.php(210): Shopware\Components\HttpCache\AppCache->lookup(Object(Symfony\Component\HttpFoundation\Request), true)
#39 engine/Shopware/Components/HttpCache/AppCache.php(114): Symfony\Component\HttpKernel\HttpCache\HttpCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#40 shopware.php(117): Shopware\Components\HttpCache\AppCache->handle(Object(Symfony\Component\HttpFoundation\Request))
#41 {main}
Jetzt bin ich ziemlich ratlos. Wie kann denn ein (meinetwegen auch fehlerhaftes) Stück Javascript dafür sorgen, dass die serverseitige Verarbeitung komplett aussteigt?