Comments (6)
That is not was unescape is for.
Template designers can choose to selectively disable this feature by adding the nofilter flag: {$variable nofilter}.
from smarty.
{* works No apply escaping *}
{form_open('news/delete',[],['news_id' => {$news['id']}]) nofilter}
<button>Delete</button>
{form_close() nofilter}
and
{* Smarty *}
<p>Hello {$name}, welcome to Smarty!</p>
{foreach $list as $item}
<p>{$item}</p>
{/foreach}
{* no escape*}
{test() nofilter}
thanks, it works.
However the word unescape
is misleading because it not related to escape
. The correct naming should be decode
as mention:
unescape is used to decode entity, html and htmlall. It counters the effects of the escape modifier for the given types.
Or as said it should counters the effects of the [escape modifier]
, which means revert the escaping, which it does not.
And nofilter
key word should be a modifier as well, like raw
( which is what twig has) or using $smarty.nofilter
to be more clear.
Thanks.
I will close the issue tomorrow or Monday
from smarty.
And another thing that maybe i will create a issue:
this is not possible with smarty:
{form_open('news/delete', hidden:['news_id' => {$news['id']}]) nofilter}
<button>Delete</button>
{form_close() nofilter}
i am using php 8.0 feature called Named Arguments, in this case hidden
name parameter and give me this error:
from smarty.
Well, Smarty is not PHP. Although the syntax is clearly inspired by PHP, their syntaxes differ greatly. Thus, I would not consider this a bug, but it might be considered as a new feature.
from smarty.
ok, but in requirements said:
Requirements: Smarty can be run with PHP 7.1 to PHP 8.2.
however it is not fully compatible with few new features like Named Arguments which should be mention in the docs.
I still didn't try this with twig but tried with Nette/Latte
template which works perfectly fine:
{form_open(
'news/delete',
hidden: ['news_id' => esc($news['id'])]
)|noescape}
you can see my full code here
from smarty.
Smarty is not PHP. The fact that Smarty can be run with PHP 7.1 to PHP 8.2 does not mean that the Syntax of Smarty is equal to the syntax of PHP. It is not, in many respects. There are some PHP language constructs that also work in Smarty and vice versa, but the similarities are in fact very limited.
from smarty.
Related Issues (20)
- Suggestion: {namspace} compile tag
- PHP Deprecated: Using Smarty::loadFilter() to load filters is deprecated and will be removed in a future release.
- Smarty v5 $smarty.template behavior doesn't match v5 documentation (it now includes a type and directory part)
- Smarty v5 built-in json_encode modifier doesn't take Smarty $_CHARSET encoding into account, and can't be overridden using registerPlugin() HOT 18
- value and name of backed enums
- use a trailing comma in arrays HOT 1
- Smarty_Internal_Template::render(): Cannot use output buffering in output buffering display handlers HOT 7
- Support nullsafe operator HOT 2
- Fatal error: Uncaught --> Smarty: Unable to write file [file_path] thrown in C:\[project_path]\vendor\smarty\smarty\src\Smarty.php on line 1732 HOT 6
- Request for `prependTemplateDir()` or more options with `addTemplateDir()` - weight, duplicate handling HOT 9
- undefined extension class 'Smarty_Internal_Method_Get_Template_Vars' HOT 1
- Is it possible patch v2 for PHP8 instead of migrating to v4+? HOT 1
- default modifier ignores nocache on variables
- Smarty registered classes check prevents use of class constants to avoid typo bugs in templates HOT 2
- 4.5.3: Function whitelist via Smarty_Security is being ignored
- Misleading error messages with {capture}
- Smarty v5 Error: {section} Tag First Argument Type Mismatch when opening and closing tag on NoCache HOT 3
- Help with Smarty dateformat modifier - change to dd/mm/yyyy HOT 5
- Error: For loop not working when using extends resource type
- Smarty Not Working HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smarty.