Dear Shopware Community,
i have a Problem with encodings in Shopware assigning a text snippet in the template.
{assign var='topBarPromoLinkText' value="{s name="MetaHeaderLeftLinkText__BR2017" namespace="topbarNavigation"}{/s}"}
I know that this is no best practice but we need to check the presence of a variable via an if condition so i need to assign it.
{if !empty($topBarPromoLink)}
{/if}
If i put a Quote in the snippet i get SmartyCompilerException:
Can anyone help me solve this so no matter what the user inserts in to the snippet in the backend the frontend just displays it as normal text!?
Error.ERROR: Uncaught Exception SmartyCompilerException: "Syntax Error in template "/var/www/myshop/engine/Shopware/Plugins/Local/Frontend/myshop_AdvancedMenu/Views/frontend/plugins/myshop_advanced_menu/index.tpl" on line 202 "{assign var='topBarPromoLinkText' value='{snippet name="MetaHeaderLeftLinkText __BR2017" namespace="myshop_TopbarNavigation" namespace='frontend/plugins/myshop_advanced_menu/index'}{/snippet}'}" - Unexpected "frontend", expected one of: "}" , " " , ATTR" at /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php line 657 {"exception":"Class: SmartyCompilerException Message: Syntax Error in template "/var/www/myshop/engine/Shopware/Plugins/Local/Frontend/myshop_AdvancedMenu/Views/frontend/plugins/myshop_advanced_menu/index.tpl" on line 202 "{assign var='topBarPromoLinkText' value='{snippet name="MetaHeaderLeftLinkText__ BR2017" namespace="myshop_TopbarNavigation" namespace='frontend/plugins/myshop_advanced_menu/index'}{/snippet}'}" - Unexpected "frontend", expected one of: "}" , " " , ATTR Stack Trace: #0 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3144): Smarty_Internal_TemplateCompilerBase->trigger_template_error()\n#1 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3209): Smarty_Internal_Templateparser->yy_syntax_error(19, 'frontend')\n#2 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(19, 'frontend')\n#3 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(192): Smarty_Internal_SmartyTemplateCompiler->doCompile('\\n\\n {* Do we ...')\n#4 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_compile_block.php(197): Smarty_Internal_TemplateCompilerBase->compileTemplate(Object(Smarty_Internal_Template))\n#5 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_compile_block.php(255): Smarty_Internal_Compile_Block::compileChildBlock(Object(Smarty_Internal_SmartyTemplateCompiler), 'frontend_index_...')\n#6 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(475): Smarty_Internal_Compile_Blockclose->compile(Array, Object(Smarty_Internal_SmartyTemplateCompiler), Array, NULL, NULL)\n#7 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(249): Smarty_Internal_TemplateCompilerBase->callTagCompiler('blockclose', Array, Array)\n#8 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(2493): Smarty_Internal_TemplateCompilerBase->compileTag('blockclose', Array)\n#9 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3101): Smarty_Internal_Templateparser->yy_r58()\n#10 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_templateparser.php(3201): Smarty_Internal_Templateparser->yy_reduce(58)\n#11 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(10, '\\n ')\n#12 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php(192): Smarty_Internal_SmartyTemplateCompiler->doCompile('{*! Include Var...')\n#13 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_template.php(187): Smarty_Internal_TemplateCompilerBase->compileTemplate(Object(Enlight_Template_Default))\n#14 /var/www/myshop/engine/Library/Smarty/sysplugins/smarty_internal_templatebase.php(155): Smarty_Internal_Template->compileTemplateSource()\n#15 /var/www/myshop/engine/Library/Enlight/View/Default.php(274): Smarty_Internal_TemplateBase->fetch()\n#16 /var/www/myshop/engine/Library/Enlight/Controller/Plugins/ViewRenderer/Bootstrap.php(216): Enlight_View_Default->render(Object(Enlight_Template_Default))\n#17 /var/www/myshop/engine/Library/Enlight/Controller/Plugins/ViewRenderer/Bootstrap.php(242): Enlight_Controller_Plugins_ViewRenderer_Bootstrap->renderTemplate(Object(Enlight_Template_Default))\n#18 /var/www/myshop/engine/Library/Enlight/Controller/Plugins/ViewRenderer/Bootstrap.php(136): Enlight_Controller_Plugins_ViewRenderer_Bootstrap->render()\n#19 /var/www/myshop/engine/Library/Enlight/Event/Handler/Default.php(91): Enlight_Controller_Plugins_ViewRenderer_Bootstrap->onPostDispatch(Object(Enlight_Controller_ActionEventArgs))\n#20 /var/www/myshop/engine/Library/Enlight/Event/EventManager.php(214): Enlight_Event_Handler_Default->execute(Object(Enlight_Controller_ActionEventArgs))\n#21 /var/www/myshop/engine/Library/Enlight/Controller/Action.php(201): Enlight_Event_EventManager->notify('Enlight_Control...', Object(Enlight_Controller_ActionEventArgs))\n#22 /var/www/myshop/engine/Library/Enlight/Controller/Dispatcher/Default.php(523): Enlight_Controller_Action->dispatch('indexAction')\n#23 /var/www/myshop/engine/Library/Enlight/Controller/Front.php(223): Enlight_Controller_Dispatcher_Default->dispatch(Object(Enlight_Controller_Request_RequestHttp), Object(Enlight_Controller_Response_ResponseHttp))\n#24 /var/www/myshop/engine/Shopware/Kernel.php(182): Enlight_Controller_Front->dispatch()\n#25 /var/www/myshop/vendor/symfony/http-kernel/HttpCache/HttpCache.php(491): Shopware\\Kernel->handle(Object(Enlight_Controller_Request_RequestHttp), 1, true)\n#26 /var/www/myshop/engine/Shopware/Components/HttpCache/AppCache.php(266): Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache->forward(Object(Symfony\\Component\\HttpFoundation\\Request), true, NULL)\n#27 /var/www/myshop/vendor/symfony/http-kernel/HttpCache/HttpCache.php(448): Shopware\\Components\\HttpCache\\AppCache->forward(Object(Symfony\\Component\\HttpFoundation\\Request), true)\n#28 /var/www/myshop/vendor/symfony/http-kernel/HttpCache/HttpCache.php(344): Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache->fetch(Object(Symfony\\Component\\HttpFoundation\\Request), true)\n#29 /var/www/myshop/engine/Shopware/Components/HttpCache/AppCache.php(187): Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache->lookup(Object(Symfony\\Component\\HttpFoundation\\Request), true)\n#30 /var/www/myshop/vendor/symfony/http-kernel/HttpCache/HttpCache.php(210): Shopware\\Components\\HttpCache\\AppCache->lookup(Object(Symfony\\Component\\HttpFoundation\\Request), true)\n#31 /var/www/myshop/engine/Shopware/Components/HttpCache/AppCache.php(114): Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#32 /var/www/myshop/custom/plugins/DTHttpCache/AppCache.php(86): Shopware\\Components\\HttpCache\\AppCache->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#33 /var/www/myshop/custom/plugins/DTHttpCache/index.php(33): DTHttpCache\\AppCache->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#34 /var/www/myshop/shopware.php(134): include('/var/www/myshop...')\n#35 {main}"} {"url":"/","ip":"127.0.0.1","http_method":"GET","server":"_","referrer":null,"file":"/var/www/myshop/engine/Shopware/Plugins/Local/Frontend/myshop_ExceptionLogging/Bootstrap.php","line":93,"class":"Shopware_Plugins_Frontend_myshop_ExceptionLogging_Bootstrap","function":"onPostDispatchError"}