Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reusable code snippets - Error #12

Open
soyniqolas opened this issue Mar 9, 2020 · 2 comments
Open

Reusable code snippets - Error #12

soyniqolas opened this issue Mar 9, 2020 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@soyniqolas
Copy link

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
Copy link

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.

@MarketSmart MarketSmart added the bug Something isn't working label Jul 11, 2022
@MarketSmart MarketSmart added this to the 1.3 milestone Jul 12, 2022
@IonutOjicaDE
Copy link

IonutOjicaDE commented Jun 9, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants