<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>{literal}</title> <meta name="generator" content="DocBook XSL Stylesheets V1.75.1"> <link rel="home" href="index.html" title="Smarty Manual"> <link rel="up" href="language.builtin.functions.html" title="Chapter 7. Built-in Functions"> <link rel="prev" href="language.function.ldelim.html" title="{ldelim},{rdelim}"> <link rel="next" href="language.function.php.html" title="{php}"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr><th colspan="3" align="center">{literal}</th></tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="language.function.ldelim.html">Prev</a> </td> <th width="60%" align="center">Chapter 7. Built-in Functions</th> <td width="20%" align="right"> <a accesskey="n" href="language.function.php.html">Next</a> </td> </tr> </table> <hr> </div> <div class="sect1" title="{literal}"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="language.function.literal"></a>{literal}</h2></div></div></div> <p> <code class="varname">{literal}</code> 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 <a class="link" href="variable.left.delimiter.html" title="$left_delimiter">delimiter</a> syntax. Anything within <code class="varname">{literal}{/literal}</code> tags is not interpreted, but displayed as-is. If you need template tags embedded in a <code class="varname">{literal}</code> block, consider using <a class="link" href="language.function.ldelim.html" title="{ldelim},{rdelim}"><code class="varname">{ldelim}{rdelim}</code></a> to escape the individual delimiters instead. </p> <div class="example"> <a name="id3053420"></a><p class="title"><b>Example 7.25. {literal} tags</b></p> <div class="example-contents"><pre class="programlisting"> {literal} <script type="text/javascript"> <!-- function isblank(field) { if (field.value == '') { return false; } else { document.loginform.submit(); return true; } } // --> </script> {/literal} </pre></div> </div> <br class="example-break"><div class="example"> <a name="id3053433"></a><p class="title"><b>Example 7.26. Javascript function example</b></p> <div class="example-contents"><pre class="programlisting"> <script language="JavaScript" type="text/javascript"> {literal} function myJsFunction(name, ip){ alert("The server name\n" + name + "\n" + ip); } {/literal} </script> <a href="javascript:myJsFunction('{$smarty.server.SERVER_NAME}','{$smarty.server.SERVER_ADDR}')">Click here for the Server Info</a> </pre></div> </div> <br class="example-break"><div class="example"> <a name="id3053453"></a><p class="title"><b>Example 7.27. Some css style in a template</b></p> <div class="example-contents"><pre class="programlisting"> {* included this style .. as an experiment *} <style type="text/css"> {literal} /* this is an intersting idea for this section */ .madIdea{ border: 3px outset #ffffff; margin: 2 3 4 5px; background-color: #001122; } {/literal} </style> <div class="madIdea">With smarty you can embed CSS in the template</div> </pre></div> </div> <br class="example-break"><p> See also <a class="link" href="language.function.ldelim.html" title="{ldelim},{rdelim}"><code class="varname">{ldelim} {rdelim}</code></a> and the <a class="link" href="language.escaping.html" title="Escaping Smarty Parsing">escaping Smarty parsing</a> page. </p> </div> <div class="navfooter"> <hr> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="language.function.ldelim.html">Prev</a> </td> <td width="20%" align="center"><a accesskey="u" href="language.builtin.functions.html">Up</a></td> <td width="40%" align="right"> <a accesskey="n" href="language.function.php.html">Next</a> </td> </tr> <tr> <td width="40%" align="left" valign="top">{ldelim},{rdelim} </td> <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td> <td width="40%" align="right" valign="top"> {php}</td> </tr> </table> </div> </body> </html>