当前位置:网站首页>Smart curly bracket escape
Smart curly bracket escape
2022-06-09 04:35:00 【Zero sky】
Use smarty The template , It's usually used ‘{’ and ‘}’ As a delimiter (delimiter).
Sometimes , We need to be in html Output braces in the code , If you write it directly in the template , Will be smarty The parser for is considered a delimiter , Then it will report an error :
smarty error : syntax error: unrecognized tag Unrecognized tags !
How to solve it ? Yes 2 Kind of way :
1: Built-in variables
ldelim, rdelim ldelim and rdelim are used for displaying the literal delimiter, in our case “{” or “}”. The template engine always tries to interpret delimiters, so this is the way around that. ldelim and rdelim Used for output delimiters , That's curly braces ‘{’ and ‘}’. If you only output a few curly braces , Please use this method .
2: Text escape
We often html It's written inside javascript function , It is inevitable to write a lot of curly braces , At this time, the above solution is not applicable ,smarty Provides a tag to escape a piece of code :
{literal}…{/literal}
{literal}
<script type="”text/javascript”">
function sayHello() {alert(‘Hello World!’)}
</script>
{/literal}such , You can write all kinds of symbols in it at will , Don't worry about smarty The engine will parse incorrectly !
边栏推荐
- “迪文杯”湖南文理学院电子设计大赛圆满结束
- API 網關 Apache APISIX 在 AWS Graviton3 上的安裝與性能測試
- [006] [ESP32開發筆記] 使用Flash下載工具燒錄固件步驟
- (9)分支循环结构
- 查看本机公网IP
- 迪文2K高分辨率智能屏发布4款新品
- Multi table query in MySQL
- golang---并发Goroutine
- golang---redis操作
- 2022 safety officer-c certificate examination practice questions simulated examination platform operation
猜你喜欢

Openinfra Foundation launched the "targeted fund" program to promote successful open source governance experience

Status mode simulates elevator operation

迪文圆形智能屏上市

golang---redis操作

Win10安装appium环境

【6.824分布式系统】LEC 6&7: Fault Tolerance: Raft

记录一次将dmp文件导入oracle数据库(本地导线上),所遇到的问题及解决方法

Record the problems encountered in importing the DMP file into Oracle database (on the local wire) and the solutions
![[004] [esp32 Development Notes] audio development framework ADF environment construction - based on esp-idf](/img/55/9eb286bc56ec991837fc014b42fc20.png)
[004] [esp32 Development Notes] audio development framework ADF environment construction - based on esp-idf

Win10注册表无法保存对权限所作的更改拒绝访问
随机推荐
PHP e签宝电子签名Saas API 对接流程
[learn FPGA programming from scratch -14]: quick start chapter - operation step 3 (functional simulation) -3-modelsim quick start (8bits cycle counter)
PDQ environment variables
Golang--- concurrent goroutine
17billion parameters, 28 open test sets SOTA, the industry's largest unified visual multi task model
查看本机公网IP
Gradle channel package configuration
2022 test question bank and simulation test of special operation certificate for installation, maintenance and demolition at heights
OpenInfra基金会发起“定向基金”计划,推行成功开源治理经验
[6.824 distributed system] LEC 6 & 7: fault tolerance: raft
Question bank and answers of G3 boiler water treatment examination in 2022
2022 R2 mobile pressure vessel filling test simulation 100 questions and simulation test
2022 safety officer-b certificate work certificate title and online simulation examination
Lua string
National information security competition for college students (ciscn) -reverse- recurrence (part)
Mysql 查询数据库中哪个表的字段个数最多
Hengyuan cloud (gpushare)_ Beyond the model of pre training NLP
[004] [ESP32开发笔记] 音频开发框架ADF环境搭建——基于ESP-IDF
1264_ Analysis of FreeRTOS task initialization and stack initialization processing
Internet behavior networking