| 
									
										
										
										
											2023-02-06 10:40:00 +01:00
										 |  |  | # {literal}
 | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | `{literal}` tags allow a block of data to be taken literally. This is | 
					
						
							|  |  |  | typically used around Javascript or stylesheet blocks where {curly | 
					
						
							|  |  |  | braces} would interfere with the template | 
					
						
							| 
									
										
										
										
											2023-08-09 00:10:41 +02:00
										 |  |  | [delimiter](../../designers/language-basic-syntax/language-escaping.md) syntax. Anything within | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | `{literal}{/literal}` tags is not interpreted, but displayed as-is. If | 
					
						
							|  |  |  | you need template tags embedded in a `{literal}` block, consider using | 
					
						
							| 
									
										
										
										
											2023-02-06 10:40:00 +01:00
										 |  |  | [`{ldelim}{rdelim}`](./language-function-ldelim.md) to escape the individual | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | delimiters instead. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | > **Note**
 | 
					
						
							|  |  |  | > | 
					
						
							|  |  |  | > `{literal}{/literal}` tags are normally not necessary, as Smarty
 | 
					
						
							|  |  |  | > ignores delimiters that are surrounded by whitespace. Be sure your
 | 
					
						
							|  |  |  | > javascript and CSS curly braces are surrounded by whitespace. This is
 | 
					
						
							|  |  |  | > new behavior to Smarty 3.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 10:40:00 +01:00
										 |  |  | ```smarty | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  |    // the following braces are ignored by Smarty | 
					
						
							|  |  |  |    // since they are surrounded by whitespace | 
					
						
							|  |  |  |    function myFoo { | 
					
						
							|  |  |  |      alert('Foo!'); | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  |    // this one will need literal escapement | 
					
						
							|  |  |  |    {literal} | 
					
						
							|  |  |  |      function myBar {alert('Bar!');} | 
					
						
							|  |  |  |    {/literal} | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | ``` | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 10:40:00 +01:00
										 |  |  | See also [`{ldelim} {rdelim}`](./language-function-ldelim.md) and the | 
					
						
							|  |  |  | [escaping Smarty parsing](../language-basic-syntax/language-escaping.md) page. |