<HTML ><HEAD ><TITLE >{literal}</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Smarty Manual" HREF="index.html"><LINK REL="UP" TITLE="Built-in Functions" HREF="language.builtin.functions.html"><LINK REL="PREVIOUS" TITLE="{ldelim},{rdelim}" HREF="language.function.ldelim.html"><LINK REL="NEXT" TITLE="{php}" HREF="language.function.php.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Smarty Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="language.function.ldelim.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 7. Built-in Functions</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="language.function.php.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="language.function.literal" ></A >{literal}</H1 ><P > <TT CLASS="varname" >{literal}</TT > 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 HREF="variable.left.delimiter.html" >delimiter</A > syntax. Anything within <TT CLASS="varname" >{literal}{/literal}</TT > tags is not interpreted, but displayed as-is. If you need template tags embedded in a <TT CLASS="varname" >{literal}</TT > block, consider using <A HREF="language.function.ldelim.html" ><TT CLASS="varname" >{ldelim}{rdelim}</TT ></A > to escape the individual delimiters instead. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN2274" ></A ><P ><B >Example 7-25. {literal} tags</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><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 ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN2277" ></A ><P ><B >Example 7-26. Javascript function example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><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 ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN2280" ></A ><P ><B >Example 7-27. Some css style in a template</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><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 ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ><P > See also <A HREF="language.function.ldelim.html" ><TT CLASS="varname" >{ldelim} {rdelim}</TT ></A > and the <A HREF="language.escaping.html" >escaping Smarty parsing</A > page. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="language.function.ldelim.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="language.function.php.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >{ldelim},{rdelim}</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="language.builtin.functions.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >{php}</TD ></TR ></TABLE ></DIV ></BODY ></HTML >