This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
One of my template files has an ampersand in the text which seems to break the page. I am getting: "We're sorry, but an unhandled error occurred. Please see the details below. Unexpected character "&"".
This block of text: "You have complete control over the look & feel of your website"
Stupid Twig, any ideas how to fix this as I would like to use ampersands.
Thanks
Can you use an HTML encoded Ampersand?
You have complete control over the look & feel of your website
Like that?
Now for some reason I am getting this with javascript as well.. My index page has a js slider that works just fine but moving to the about page which has similiar js in the exact same format spits out:
Unexpected character "$" line 149: $(function() {
This makes no sense, it's the exact same code..
Sure, this is the index page which renders correctly: http://laravel.io/bin/ny99W
And this is the about page which is displaying the error: http://laravel.io/bin/XLjjq
Thank you for taking a look
I have tried to replicate this error in Layout
, Page
, Partial
and Content
templates, using both the &
and &
variations, outputting as HTML code in a <p>
tag and as a Twig {{ "string" }}
and don't get any errors - how are you injecting the code into your layout?
Last updated
Hi, how you solve that, i still got this error message
"Unexpected character "&" in "__string_template__07bf747766b2eecbc58cda608ded4df65f43f0d6f26eb9fbe34dacf0afb39b3b" at line 1." on line 284 of /home/vagrant/Code/test/public/vendor/twig/twig/lib/Twig/Lexer.php
and this is my email template
Name : {{ name }}
Email : {{ email }}
{{ description }}
it's working well if i remove {{ description }}
which is that is textarea
Last updated
after trial and error it's worked now
i just need to remove space between variables and curly braces
i use {{description}}
instead {{ description }}
i don't know why but it's worked
Just experiencing this error for the first time. The partial I'm having trouble with is relatively complex from a TWIG-parsing standpoint: There are numerous translatable {{ "strings"|_ }}, and I'm also using jQuery plugin Tooltipster to produce tooltips, with the contentAsHTML property set to true, which allows for encoded tags to be included in the tooltip elements' title attributes, so that means I've got multiple lines that look like the following:
{{"WYSIWYG"|_}}<span class="tooltip" title="<span>({{"What You See Is What You Get"}})</span>">✽</span>
Removing the spaces between the brackets and the strings has not cleared up the error or caused a different one, but I'm still experimenting, so I will post whatever solution I find if and when I find it...
Well, turns out to have been just another case of lousy TWIG error reporting. I had one translatable string that began with a double-quote but ended with a single-quote, and that was fouling everything up. During my debugging, I did manage to get a different error message than the original one about the ampersand (which clued me into the actual syntax error) by replacing all my HTML-encoded attributes with stuff like this:
{{ '</span>'|e('html_attr') }}
But having fixed the mismatched quotation marks, I'm rolling all that back and it's still working now...
Just create new email template and paste current mail template to created. it work.
1-15 of 15