Sophie

Sophie

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

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

<HTML
><HEAD
><TITLE
>Embedding Vars in Double Quotes</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="Basic Syntax"
HREF="language.basic.syntax.html"><LINK
REL="PREVIOUS"
TITLE="Attributes"
HREF="language.syntax.attributes.html"><LINK
REL="NEXT"
TITLE="Math"
HREF="language.math.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.syntax.attributes.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 3. Basic Syntax</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="language.math.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="language.syntax.quotes"
></A
>Embedding Vars in Double Quotes</H1
><P
>&#13;  Smarty will recognize <A
HREF="api.assign.html"
>assigned</A
>
  <A
HREF="language.syntax.variables.html"
>variables</A
>
  embedded in double quotes so long as the variable name contains only numbers,
  letters, underscores and brackets[]
  (see <A
HREF="http://php.net/language.variables"
TARGET="_top"
>naming</A
>).
  With any other characters (period,
  object reference, etc.) the variable must be surrounded by
  `backticks`. You cannot embed
  <A
HREF="language.modifiers.html"
>modifiers</A
>, they must always
  be applied outside of quotes.
 </P
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN311"
></A
><P
><B
>Example 3-5. embedded quotes syntax</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="programlisting"
>SYNTAX EXAMPLES:
{func var="test $foo test"}       &#60;-- sees $foo
{func var="test $foo_bar test"}   &#60;-- sees $foo_bar
{func var="test $foo[0] test"}    &#60;-- sees $foo[0]
{func var="test $foo[bar] test"}  &#60;-- sees $foo[bar]
{func var="test $foo.bar test"}   &#60;-- sees $foo (not $foo.bar)
{func var="test `$foo.bar` test"} &#60;-- sees $foo.bar
{func var="test `$foo.bar` test"|escape} &#60;-- modifiers outside quotes!

PRACTICAL EXAMPLES:
{include file="subdir/$tpl_name.tpl"} &#60;-- will replace $tpl_name with value
{cycle values="one,two,`$smarty.config.myval`"} &#60;-- must have backticks</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
><P
>&#13;  See also <A
HREF="language.modifier.escape.html"
><TT
CLASS="varname"
>escape</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.syntax.attributes.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.math.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Attributes</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="language.basic.syntax.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Math</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>