Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > by-pkgid > 8377d4bb25a3992aad680df2952f4b71 > files > 53

php-smarty-doc-2.6.26-1mdv2010.0.noarch.rpm

<HTML
><HEAD
><TITLE
>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="Smarty For Template Designers"
HREF="smarty.for.designers.html"><LINK
REL="PREVIOUS"
TITLE="{textformat}"
HREF="language.function.textformat.html"><LINK
REL="NEXT"
TITLE="Debugging Console"
HREF="chapter.debugging.console.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="chapter"
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.textformat.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="chapter.debugging.console.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="chapter"
><H1
><A
NAME="config.files"
></A
>Chapter 9. Config Files</H1
><P
>&#13;  Config files are handy for designers to manage global template
  variables from one file. One example is template colors.  Normally
  if you wanted to change the color scheme of an application, you
  would have to go through each and every template file and change the
  colors. With a config file, the colors can be kept in one place, and
  only one file needs to be updated.
 </P
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN4693"
></A
><P
><B
>Example 9-1. Example of config file syntax</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="programlisting"
># global variables
pageTitle = "Main Menu"
bodyBgColor = #000000
tableBgColor = #000000
rowBgColor = #00ff00

[Customer]
pageTitle = "Customer Info"

[Login]
pageTitle = "Login"
focus = "username"
Intro = """This is a value that spans more
           than one line. you must enclose
           it in triple quotes."""

# hidden section
[.Database]
host=my.example.com
db=ADDRESSBOOK
user=php-user
pass=foobar</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
><P
>&#13;  Values of <A
HREF="language.config.variables.html"
>config file
  variables</A
> can be in quotes, but not necessary.  You can use
  either single or double quotes. If you have a value that spans more
  than one line, enclose the entire value with triple quotes
  ("""). You can put comments into config files by any syntax that is
  not a valid config file syntax. We recommend using a <TT
CLASS="literal"
>&#13;  #</TT
> (hash) at the beginning of the line.
 </P
><P
>&#13;  The example config file above has two sections. Section names are
  enclosed in [brackets]. Section names can be arbitrary strings not
  containing <TT
CLASS="literal"
>[</TT
> or <TT
CLASS="literal"
>]</TT
> symbols. The
  four variables at the top are global variables, or variables not
  within a section.  These variables are always loaded from the config
  file. If a particular section is loaded, then the global variables
  and the variables from that section are also loaded. If a variable
  exists both as a global and in a section, the section variable is
  used. If you name two variables the same within a section, the last
  one will be used unless <A
HREF="variable.config.overwrite.html"
>&#13;  <TT
CLASS="parameter"
><I
>$config_overwrite</I
></TT
></A
> is disabled.
 </P
><P
>&#13;  Config files are loaded into templates with the built-in template function
  <A
HREF="language.function.config.load.html"
><TT
CLASS="varname"
>&#13;  {config_load}</TT
></A
> or the API <A
HREF="api.config.load.html"
><TT
CLASS="varname"
>config_load()</TT
></A
> function.
 </P
><P
>&#13;  You can hide variables or entire sections by prepending the variable
  name or section name with a period eg <TT
CLASS="literal"
>[.hidden]</TT
>. This is useful if your
  application reads the config files and gets sensitive data from them
  that the template engine does not need. If you have third parties
  doing template editing, you can be certain that they cannot read
  sensitive data from the config file by loading it into the template.
 </P
><P
>&#13;  See also
  <A
HREF="language.function.config.load.html"
><TT
CLASS="varname"
>{config_load}</TT
></A
>,
  <A
HREF="variable.config.overwrite.html"
><TT
CLASS="parameter"
><I
>$config_overwrite</I
></TT
></A
>,
  <A
HREF="api.get.config.vars.html"
><TT
CLASS="varname"
>get_config_vars()</TT
></A
>,
  <A
HREF="api.clear.config.html"
><TT
CLASS="varname"
>clear_config()</TT
></A
>
  and
  <A
HREF="api.config.load.html"
><TT
CLASS="varname"
>config_load()</TT
></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.function.textformat.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="chapter.debugging.console.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>{textformat}</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="smarty.for.designers.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Debugging Console</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>