<HTML ><HEAD ><TITLE >Variables loaded from config files</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="Variables" HREF="language.variables.html"><LINK REL="PREVIOUS" TITLE="Variables" HREF="language.variables.html"><LINK REL="NEXT" TITLE="{$smarty} reserved variable" HREF="language.variables.smarty.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.variables.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 4. Variables</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="language.variables.smarty.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="language.config.variables" ></A >Variables loaded from config files</H1 ><P > Variables that are loaded from the <A HREF="config.files.html" >config files</A > are referenced by enclosing them within <TT CLASS="literal" >#hash marks#</TT >, or with the smarty variable <A HREF="language.variables.smarty.html#language.variables.smarty.config" > <TT CLASS="parameter" ><I >$smarty.config</I ></TT ></A >. The later syntax is useful for embedding into quoted attribute values. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN422" ></A ><P ><B >Example 4-6. config variables</B ></P ><P > Example config file - <TT CLASS="filename" >foo.conf</TT >: </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="programlisting" >pageTitle = "This is mine" bodyBgColor = '#eeeeee' tableBorderSize = 3 tableBgColor = "#bbbbbb" rowBgColor = "#cccccc"</PRE ></TD ></TR ></TABLE ><P > A template demonstrating the <TT CLASS="parameter" ><I >#hash#</I ></TT > method: </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="programlisting" >{config_load file='foo.conf'} <html> <title>{#pageTitle#}</title> <body bgcolor="{#bodyBgColor#}"> <table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}"> <tr bgcolor="{#rowBgColor#}"> <td>First</td> <td>Last</td> <td>Address</td> </tr> </table> </body> </html></PRE ></TD ></TR ></TABLE ><P > A template demonstrating the <A HREF="language.variables.smarty.html#language.variables.smarty.config" > <TT CLASS="parameter" ><I >$smarty.config</I ></TT ></A > method: </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="programlisting" >{config_load file='foo.conf'} <html> <title>{$smarty.config.pageTitle}</title> <body bgcolor="{$smarty.config.bodyBgColor}"> <table border="{$smarty.config.tableBorderSize}" bgcolor="{$smarty.config.tableBgColor}"> <tr bgcolor="{$smarty.config.rowBgColor}"> <td>First</td> <td>Last</td> <td>Address</td> </tr> </table> </body> </html></PRE ></TD ></TR ></TABLE ><P > Both examples would output: </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" ><html> <title>This is mine</title> <body bgcolor="#eeeeee"> <table border="3" bgcolor="#bbbbbb"> <tr bgcolor="#cccccc"> <td>First</td> <td>Last</td> <td>Address</td> </tr> </table> </body> </html></PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ><P > Config file variables cannot be used until after they are loaded in from a config file. This procedure is explained later in this document under <A HREF="language.function.config.load.html" > <TT CLASS="varname" >{config_load}</TT ></A >. </P ><P > See also <A HREF="language.syntax.variables.html" >variables</A > and <A HREF="language.variables.smarty.html" >$smarty reserved variables</A > </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.variables.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.variables.smarty.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Variables</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="language.variables.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >{$smarty} reserved variable</TD ></TR ></TABLE ></DIV ></BODY ></HTML >