Logicify / mautic-advanced-templates-bundle

Plugin extends default email template capabilities with TWIG block so you can use advanced scripting techniques like conditions, loops etc
https://logicify.com/?utm_source=github&utm_campaign=mautic-templates&utm_medium=opensource
MIT License
89 stars 57 forks source link

Reusable code snippets - Error #12

Open soyniqolas opened 4 years ago

soyniqolas commented 4 years ago

Hi ! I'm trying to use a reusable code snippet creating a Dynamic Content and including it on my email using the next code:

{% TWIG_BLOCK %} {{ include('dc:featured-products') }} {% END_TWIG_BLOCK %}

In the Dynamic Content I declare some variables using {% set products = items.products %}, but It returns me a 500 Error.

On the Mautic error log I got this message: [2020-03-09 12:36:09] mautic.CRITICAL: Uncaught PHP Exception Twig_Error_Syntax: "Unexpected token "operator" of value "%" in "dc:featured-products" at line 3." at /vendor/twig/twig/lib/Twig/ExpressionParser.php line 208 {"exception":"[object] (Twig_Error_Syntax(code: 0): Unexpected token \"operator\" of value \"%\" in \"dc:featured-products\" at line 3. at /vendor/twig/twig/lib/Twig/ExpressionParser.php:208)"} []

Does the 'include' TWIG function support variable declaration or anything that starts with {% ? In the example of this plugin there is only variable printing with {{ }}.

szczepkacpra commented 4 years ago

I have a similar issue. I've successfully used techniques from Example 1 & 2. I was unable to replicate working Example 3, despite closely following the documentation. If not for the cart functionality, I was hoping it could be a workaround Matutics lack of globally updatable variables.

It seems this feature doesn't work anymore. At least not on Mautic 2.16.2 & PHP 7.3.18.

IonutOjicaDE commented 1 year ago

I can confirm: inserting a Dynamic Web Content in emails works in Mautic 4.4.8 .

I had some errors, but something else has caused them.