<HTML ><HEAD ><TITLE >$compile_id</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="Smarty Class Variables" HREF="api.variables.html"><LINK REL="PREVIOUS" TITLE="$error_reporting" HREF="variable.error.reporting.html"><LINK REL="NEXT" TITLE="$use_sub_dirs" HREF="variable.use.sub.dirs.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="variable.error.reporting.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 12. Smarty Class Variables</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="variable.use.sub.dirs.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="variable.compile.id" ></A >$compile_id</H1 ><P > Persistant compile identifier. As an alternative to passing the same <TT CLASS="parameter" ><I >$compile_id</I ></TT > to each and every function call, you can set this <TT CLASS="parameter" ><I >$compile_id</I ></TT > and it will be used implicitly thereafter. </P ><P > With a <TT CLASS="parameter" ><I >$compile_id</I ></TT > you can work around the limitation that you cannot use the same <A HREF="variable.compile.dir.html" ><TT CLASS="parameter" ><I >$compile_dir</I ></TT ></A > for different <A HREF="api.variables.html#variable.template.dir" > <TT CLASS="parameter" ><I >$template_dirs</I ></TT ></A >. If you set a distinct <TT CLASS="parameter" ><I >$compile_id</I ></TT > for each <A HREF="api.variables.html#variable.template.dir" ><TT CLASS="parameter" ><I >$template_dir</I ></TT > </A > then Smarty can tell the compiled templates apart by their <TT CLASS="parameter" ><I >$compile_id</I ></TT >. </P ><P > If you have for example a <A HREF="plugins.prefilters.postfilters.html" >prefilter</A > that localizes your templates (that is: translates language dependend parts) at compile time, then you could use the current language as <TT CLASS="parameter" ><I >$compile_id</I ></TT > and you will get a set of compiled templates for each language you use. </P ><P > Another application would be to use the same compile directory across multiple domains / multiple virtual hosts. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN5324" ></A ><P ><B >Example 12-6. $compile_id in a virtual host enviroment</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br />$smarty</span><span style="color: #007700">-></span><span style="color: #0000BB">compile_id </span><span style="color: #007700">= </span><span style="color: #0000BB">$_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">'SERVER_NAME'</span><span style="color: #007700">];<br /></span><span style="color: #0000BB">$smarty</span><span style="color: #007700">-></span><span style="color: #0000BB">compile_dir </span><span style="color: #007700">= </span><span style="color: #DD0000">'/path/to/shared_compile_dir'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></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="variable.error.reporting.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="variable.use.sub.dirs.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >$error_reporting</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="api.variables.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >$use_sub_dirs</TD ></TR ></TABLE ></DIV ></BODY ></HTML >