Smarty: unrecognized tag 'literal' - tags

I thought that enclosing the javascript-block in a {literal}...{/literal} block will prevent smarty from parsing it, but...
This code in troll.tpl causes Syntax Error: unrecognized tag 'literal', dunno why.
{literal}
<script>
....
</script>
{/literal}
PHP 5.5 and Smarty 2.6

I solved this problem.
The error comes, because I wanted to patch smarty by change deprecated preg_match("/.../e"); to preg_match_callback(...);, but now I restored changes and then I modified my error_reporting(E_ALL & ~E_WARNING); to error_reporting(E_ALL & ~E_WARNING & ~E_DEPRECATED); And now everything works well.

Related

EJS giving error "Error: property value expected" when used inside a style attribute

I am trying to set a background color on my div based on a a color send down by my server. I can't solve this with classes because the color value could be any legal color value. However, VSCode is giving me an error when I type the following. Is EJS not allowed to use with css related stuff?
<div style="background-color: <%= display_color %>;"></div> // Error: property value expected
This is an ESLint error. ESLint is a linting tool. It can help you find and fix (mostly/usually) stylistic problems with your code. It's highly configurable, and can also be used to auto-fix some problems for you.
As you already found, you can disable the lint warning for a single site/line like so:
<div <% /* eslint-disable css-propertyvalueexpected */ %> style='background-color: <%= display_color %>;'></div>
If you want to disable the warning once and for all, create an ESLint configuration file and do it there.
If you haven't installed the ESLint NPM package to use it that way, you're probably getting this because of one of your VS Code extensions.

TYPO3 / Fluid: Inline Viewhelper notation in Templates of FluidEmail

I’m using the new TYPO3\CMS\Core\Mail\FluidEmail feature of TYPO3 v10.3 to send HTML system e-mails. Unfortunately, I’m experiencing a weird behavior with Viewhelpers in the e-mail Templates. Calling the regular Viewhelper notation like e.g. <f:uri.resource extensionName="backend" path="Images/typo3_orange.svg"/> works as expected. But inline notations of the same Viewhelper (like {f:uri.resource(extensionName: 'backend', path: 'Images/typo3_orange.svg')}) don’t get processed at all.
Surprisingly, when I call the regular notation first and the inline notation afterwards in the same template, both notations get resolved.
I also experienced that no fluid variables are accessible in the template, e.g. {normalizedParams}, which should be available when you set the request like $message->setRequest($GLOBALS['TYPO3_REQUEST']);
Did anyone experience a similar behavior and has a hint for me?
Here's my implementation in my Controller Action:
$message = GeneralUtility::makeInstance(FluidEmail::class);
$message
->to($email)
->format(FluidEmail::FORMAT_HTML)
->setTemplate('MyTemplate')
->assign('pages', $pages);
if ($GLOBALS['TYPO3_REQUEST'] instanceof ServerRequestInterface) {
$message->setRequest($GLOBALS['TYPO3_REQUEST']);
}
GeneralUtility::makeInstance(Mailer::class)->send($message);
Reference: https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/10.3/Feature-90266-Fluid-basedTemplatedEmails.html
Sounds like a fluid parsing problem. Do you have any { or } flying around in your template that could mess up fluids parsing?
Just run into the same problem with one of my in-house plugins after switching from php7.2 to php7.4 (when switching back to php7.2 the resource path was resolved again correctly).
It turned out that some inline javascript using curly brackets further down the page was to blame (thank you Daniel). Putting it in a separate file solved the issue. It would appear that the use of inline JS is tolerated to different degrees depending on the php version being used.

Babel error: JSX value should be either an expression or a quoted JSX text

I'm getting an error from Babel when trying to compile my JSX code into JS. I'm new to react so apologies if this is an obvious issue, I wasn't able to find anything about it that seemed related. I'm attempting to use props in this chunk of code, and pass a pageTitle prop to my FieldContainer component. This is giving me an issue, though, that isn't letting the code compile to JS. I discovered in my searching that prop values should be passed between {}, but adding these did not help. Any ideas? Thanks!
It's hard to tell what you are trying to do here, but as the error says, the value of an attribute must be an expression {foo} or quoted text "foo".
In this case
Child={<LoginForm />}
or
Child={LoginForm}
is probably what you want.
I got this error because I failed to quote a property inside of the JSX:
<span aria-hidden=true ...
should have been
<span aria-hidden="true" ...
Just faced same issue, I was writing
component="Contacts"
resolved it by rewriting it as:
component={Contacts}

Attribute value uses wrong case character Error in eclipse

I'm getting the following error in Eclipse juno:
Attribute value (POST) uses wrong case character
in the following line inside one of my HTML files:
<form action="http://allteamz.us5.list-manage.com/subscribe/post"
method="POST" id="mc-embedded-subscribe-form">
Is there a way to tell eclipse to "ignore" this error? Tried a few things but nothing seems to be working..
Go to Windows>>Preferences>>Web>>HTML Files>>Validation. A list should be shown and there should exist a title in bold called "Attributes". Selecting "Ignore" for the option "Attribute value using wrong case character" should solve it.
According to W3Schools the allowed values for the method attribute in a form element are only 'get' and 'post', lower case, so I think a better solution is change to lower case. This is strange to me because everywhere else these methods seem to be capitalized.
Eclipse was acting funky but after the restart the normal validation-ignore worked.
Go to Eclipse (or Window) -> Preferences -> Validation -> HTML Syntax Validator, and then 'uncheck' both manual and build
Instead of ignoring the issue through Eclipse configuration try to use proper tag .
This error comes if something like this written
< div onClick="..." > < /div>
Here one need to write onclick="" ; C in lower case .

Coffee script with erb extension gives missing template error

I am using rails 3.2.11 and coffee rails 3.2.2.
Here I am trying to render a coffee script in a file /app/views/my_files/create.js.coffee.erb
Here is what my controller code looks like
class MyFilesController < ApplicationController
respond_to :js
def create
end
end
On hitting create action I get missing template error. But when I rename file create.js.coffee.erb to create.js.coffee it works fine.
I am not understanding what is the problem with .erb extension over .coffee, and in this case why it gives missing template error, when template is already there?
Thanks
Rename your file to create.js.coffee
See
How to render new.js.coffee.erb in app/views?
Just had the same problem...
Is there a particular reason you are trying to render coffeescript as a view rather than using it as an asset?
.erb is a ruby script file that produces an html file when compiled.
.js.coffee results in a .js file when compiled. You should be using .erb with a create.html.erb template that in turn uses your create.js.coffee.
<%= javascript_include_tag "create" %>
This should be in your create.html.erb which will be called by the create method in your MyFilesController