Clean up:

- domain.com => example.com, as suggested by RFC 2606
- fix and introduce more dockbook tags
- fix white spaces and use CDATA sections
- add some paras to make the text more reader friendly
This commit is contained in:
didou
2004-11-21 02:04:01 +00:00
parent 659563b570
commit 9d4d0c08a1
18 changed files with 810 additions and 787 deletions

View File

@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<chapter id="resources"> <chapter id="resources">
<title>Resources</title> <title>Resources</title>
<para> <para>
Smarty's homepage is located at <ulink Smarty's homepage is located at <ulink
url="&url.smarty;">&url.smarty;</ulink>. url="&url.smarty;">&url.smarty;</ulink>.
You can join the mailing list by sending an e-mail to You can join the mailing list by sending an e-mail to
&ml.general.sub;. An archive of the mailing list can &ml.general.sub;. An archive of the mailing list can
be viewed at <ulink url="&url.ml.archive;">&url.ml.archive;</ulink>. be viewed at <ulink url="&url.ml.archive;">&url.ml.archive;</ulink>.
</para> </para>
</chapter> </chapter>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -240,22 +240,22 @@ function insert_header($params)
<!-- begin new wml deck --> <!-- begin new wml deck -->
<wml> <wml>
<!-- begin first card --> <!-- begin first card -->
<card> <card>
<do type="accept"> <do type="accept">
<go href="#two"/> <go href="#two"/>
</do> </do>
<p> <p>
Welcome to WAP with Smarty! Welcome to WAP with Smarty!
Press OK to continue... Press OK to continue...
</p> </p>
</card> </card>
<!-- begin second card --> <!-- begin second card -->
<card id="two"> <card id="two">
<p> <p>
Pretty easy isn't it? Pretty easy isn't it?
</p> </p>
</card> </card>
</wml> </wml>
]]> ]]>
</programlisting> </programlisting>
@@ -307,10 +307,7 @@ function smarty_function_load_ticker($params, &$smarty)
</programlisting> </programlisting>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
index.tpl {* in index.tpl *}
---------
{* Smarty *}
{load_ticker symbol="YHOO" assign="ticker"} {load_ticker symbol="YHOO" assign="ticker"}
@@ -332,8 +329,7 @@ Stock Name: {$ticker.name} Stock Price: {$ticker.price}
<title>Example of Obfuscating an E-mail Address</title> <title>Example of Obfuscating an E-mail Address</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
index.tpl {* in index.tpl *}
---------
Send inquiries to Send inquiries to
{mailto address=$EmailAddress encode="javascript" subject="Hello"} {mailto address=$EmailAddress encode="javascript" subject="Hello"}

View File

@@ -4,10 +4,12 @@
<title>Smarty - the compiling PHP template engine</title> <title>Smarty - the compiling PHP template engine</title>
<authorgroup id="authors"> <authorgroup id="authors">
<author> <author>
<firstname>Monte</firstname><surname>Ohrt &lt;monte@ispi.net&gt;</surname> <firstname>Monte</firstname>
<surname>Ohrt &lt;monte@ispi.net&gt;</surname>
</author> </author>
<author> <author>
<firstname>Andrei</firstname><surname>Zmievski &lt;andrei@php.net&gt;</surname> <firstname>Andrei</firstname>
<surname>Zmievski &lt;andrei@php.net&gt;</surname>
</author> </author>
</authorgroup> </authorgroup>
<pubdate>&build-date;</pubdate> <pubdate>&build-date;</pubdate>

View File

@@ -32,7 +32,7 @@ Intro = """This is a value that spans more
# hidden section # hidden section
[.Database] [.Database]
host=my.domain.com host=my.example.com
db=ADDRESSBOOK db=ADDRESSBOOK
user=php-user user=php-user
pass=foobar pass=foobar

View File

@@ -79,7 +79,7 @@
{* body of template goes here *} {* body of template goes here *}
{include file="footer.tpl" logo="http://my.domain.com/logo.gif"}</programlisting> {include file="footer.tpl" logo="http://my.example.com/logo.gif"}</programlisting>
</example> </example>
<para> <para>
Use the syntax for <link Use the syntax for <link
@@ -121,4 +121,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml vim: et tw=78 syn=sgml
vi: ts=1 sw=1 vi: ts=1 sw=1
--> -->

View File

@@ -174,21 +174,21 @@ name: John Smith&lt;br&gt;
address: 253 N 45th&lt;br&gt; address: 253 N 45th&lt;br&gt;
home phone: 555-555-5555&lt;br&gt; home phone: 555-555-5555&lt;br&gt;
cell phone: 555-555-5555&lt;br&gt; cell phone: 555-555-5555&lt;br&gt;
e-mail: john@mydomain.com&lt;br&gt; e-mail: john@myexample.com&lt;br&gt;
&lt;p&gt; &lt;p&gt;
id: 1001&lt;br&gt; id: 1001&lt;br&gt;
name: Jack Jones&lt;br&gt; name: Jack Jones&lt;br&gt;
address: 417 Mulberry ln&lt;br&gt; address: 417 Mulberry ln&lt;br&gt;
home phone: 555-555-5555&lt;br&gt; home phone: 555-555-5555&lt;br&gt;
cell phone: 555-555-5555&lt;br&gt; cell phone: 555-555-5555&lt;br&gt;
e-mail: jack@mydomain.com&lt;br&gt; e-mail: jack@myexample.com&lt;br&gt;
&lt;p&gt; &lt;p&gt;
id: 1002&lt;br&gt; id: 1002&lt;br&gt;
name: Jane Munson&lt;br&gt; name: Jane Munson&lt;br&gt;
address: 5605 apple st&lt;br&gt; address: 5605 apple st&lt;br&gt;
home phone: 555-555-5555&lt;br&gt; home phone: 555-555-5555&lt;br&gt;
cell phone: 555-555-5555&lt;br&gt; cell phone: 555-555-5555&lt;br&gt;
e-mail: jane@mydomain.com&lt;br&gt; e-mail: jane@myexample.com&lt;br&gt;
&lt;p&gt;</programlisting> &lt;p&gt;</programlisting>
</example> </example>
@@ -210,15 +210,15 @@ OUTPUT:
name: John Smith&lt;br&gt; name: John Smith&lt;br&gt;
home: 555-555-5555&lt;br&gt; home: 555-555-5555&lt;br&gt;
cell: 555-555-5555&lt;br&gt; cell: 555-555-5555&lt;br&gt;
e-mail: john@mydomain.com&lt;p&gt; e-mail: john@myexample.com&lt;p&gt;
name: Jack Jones&lt;br&gt; name: Jack Jones&lt;br&gt;
home phone: 555-555-5555&lt;br&gt; home phone: 555-555-5555&lt;br&gt;
cell phone: 555-555-5555&lt;br&gt; cell phone: 555-555-5555&lt;br&gt;
e-mail: jack@mydomain.com&lt;p&gt; e-mail: jack@myexample.com&lt;p&gt;
name: Jane Munson&lt;br&gt; name: Jane Munson&lt;br&gt;
home phone: 555-555-5555&lt;br&gt; home phone: 555-555-5555&lt;br&gt;
cell phone: 555-555-5555&lt;br&gt; cell phone: 555-555-5555&lt;br&gt;
e-mail: jane@mydomain.com&lt;p&gt;</programlisting> e-mail: jane@myexample.com&lt;p&gt;</programlisting>
</example> </example>

View File

@@ -44,7 +44,7 @@
OUTPUT: OUTPUT:
<table border=0><tr><td><A HREF="http://my.domain.com"><font color="red">This is a test</font></A></td></tr></table> <table border=0><tr><td><A HREF="http://my.example.com"><font color="red">This is a test</font></A></td></tr></table>
]]> ]]>
</programlisting> </programlisting>
</example> </example>

View File

@@ -71,13 +71,13 @@
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{* include some javascript in your template *} {* include some javascript in your template *}
{fetch file="/export/httpd/www.domain.com/docs/navbar.js"} {fetch file="/export/httpd/www.example.com/docs/navbar.js"}
{* embed some weather text in your template from another web site *} {* embed some weather text in your template from another web site *}
{fetch file="http://www.myweather.com/68502/"} {fetch file="http://www.myweather.com/68502/"}
{* fetch a news headline file via ftp *} {* fetch a news headline file via ftp *}
{fetch file="ftp://user:password@ftp.domain.com/path/to/currentheadlines.txt"} {fetch file="ftp://user:password@ftp.example.com/path/to/currentheadlines.txt"}
{* assign the fetched contents to a template variable *} {* assign the fetched contents to a template variable *}
{fetch file="http://www.myweather.com/68502/" assign="weather"} {fetch file="http://www.myweather.com/68502/" assign="weather"}
@@ -107,4 +107,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml vim: et tw=78 syn=sgml
vi: ts=1 sw=1 vi: ts=1 sw=1
--> -->

View File

@@ -1,62 +1,62 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.html.options"> <sect1 id="language.function.html.options">
<title>html_options</title> <title>html_options</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
<colspec colname="type" align="center" /> <colspec colname="type" align="center" />
<colspec colname="required" align="center" /> <colspec colname="required" align="center" />
<colspec colname="default" align="center" /> <colspec colname="default" align="center" />
<colspec colname="desc" /> <colspec colname="desc" />
<thead> <thead>
<row> <row>
<entry>Attribute Name</entry> <entry>Attribute Name</entry>
<entry>Type</entry> <entry>Type</entry>
<entry>Required</entry> <entry>Required</entry>
<entry>Default</entry> <entry>Default</entry>
<entry>Description</entry> <entry>Description</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>values</entry> <entry>values</entry>
<entry>array</entry> <entry>array</entry>
<entry>Yes, unless using options attribute</entry> <entry>Yes, unless using options attribute</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>an array of values for dropdown</entry> <entry>an array of values for dropdown</entry>
</row> </row>
<row> <row>
<entry>output</entry> <entry>output</entry>
<entry>array</entry> <entry>array</entry>
<entry>Yes, unless using options attribute</entry> <entry>Yes, unless using options attribute</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>an array of output for dropdown</entry> <entry>an array of output for dropdown</entry>
</row> </row>
<row> <row>
<entry>selected</entry> <entry>selected</entry>
<entry>string/array</entry> <entry>string/array</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
<entry>the selected option element(s)</entry> <entry>the selected option element(s)</entry>
</row> </row>
<row> <row>
<entry>options</entry> <entry>options</entry>
<entry>associative array</entry> <entry>associative array</entry>
<entry>Yes, unless using values and output</entry> <entry>Yes, unless using values and output</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>an associative array of values and output</entry> <entry>an associative array of values and output</entry>
</row> </row>
<row> <row>
<entry>name</entry> <entry>name</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
<entry>name of select group</entry> <entry>name of select group</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
html_options is a custom function that creates html option group html_options is a custom function that creates html option group
with provided data. It takes care of which item(s) are selected by with provided data. It takes care of which item(s) are selected by
@@ -146,4 +146,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml vim: et tw=78 syn=sgml
vi: ts=1 sw=1 vi: ts=1 sw=1
--> -->

View File

@@ -1,134 +1,129 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.mailto"> <sect1 id="language.function.mailto">
<title>mailto</title> <title>mailto</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
<colspec colname="type" align="center" /> <colspec colname="type" align="center" />
<colspec colname="required" align="center" /> <colspec colname="required" align="center" />
<colspec colname="default" align="center" /> <colspec colname="default" align="center" />
<colspec colname="desc" /> <colspec colname="desc" />
<thead> <thead>
<row> <row>
<entry>Attribute Name</entry> <entry>Attribute Name</entry>
<entry>Type</entry> <entry>Type</entry>
<entry>Required</entry> <entry>Required</entry>
<entry>Default</entry> <entry>Default</entry>
<entry>Description</entry> <entry>Description</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>address</entry> <entry>address</entry>
<entry>string</entry> <entry>string</entry>
<entry>Yes</entry> <entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>the e-mail address</entry> <entry>the e-mail address</entry>
</row> </row>
<row> <row>
<entry>text</entry> <entry>text</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>the text to display, default is <entry>the text to display, default is the e-mail address</entry>
the e-mail address</entry> </row>
</row> <row>
<row> <entry>encode</entry>
<entry>encode</entry> <entry>string</entry>
<entry>string</entry> <entry>No</entry>
<entry>No</entry> <entry><emphasis>none</emphasis></entry>
<entry><emphasis>none</emphasis></entry> <entry>How to encode the e-mail. Can be one of <literal>none</literal>,
<entry>How to encode the e-mail. <literal>hex</literal> or <literal>javascript</literal>.</entry>
Can be one of none, </row>
hex or javascript.</entry> <row>
</row> <entry>cc</entry>
<row> <entry>string</entry>
<entry>cc</entry> <entry>No</entry>
<entry>string</entry> <entry><emphasis>n/a</emphasis></entry>
<entry>No</entry> <entry>e-mail addresses to carbon copy. Separate entries by a comma.
<entry><emphasis>n/a</emphasis></entry> </entry>
<entry>e-mail addresses to carbon copy. </row>
Separate entries by a comma.</entry> <row>
</row> <entry>bcc</entry>
<row> <entry>string</entry>
<entry>bcc</entry> <entry>No</entry>
<entry>string</entry> <entry><emphasis>n/a</emphasis></entry>
<entry>No</entry> <entry>e-mail addresses to blind carbon copy.
<entry><emphasis>n/a</emphasis></entry> Separate entries by a comma.</entry>
<entry>e-mail addresses to blind carbon copy. </row>
Separate entries by a comma.</entry> <row>
</row> <entry>subject</entry>
<row> <entry>string</entry>
<entry>subject</entry> <entry>No</entry>
<entry>string</entry> <entry><emphasis>n/a</emphasis></entry>
<entry>No</entry> <entry>e-mail subject.</entry>
<entry><emphasis>n/a</emphasis></entry> </row>
<entry>e-mail subject.</entry> <row>
</row> <entry>newsgroups</entry>
<row> <entry>string</entry>
<entry>newsgroups</entry> <entry>No</entry>
<entry>string</entry> <entry><emphasis>n/a</emphasis></entry>
<entry>No</entry> <entry>newsgroups to post to. Separate entries by a comma.</entry>
<entry><emphasis>n/a</emphasis></entry> </row>
<entry>newsgroups to post to. <row>
Separate entries by a comma.</entry> <entry>followupto</entry>
</row> <entry>string</entry>
<row> <entry>No</entry>
<entry>followupto</entry> <entry><emphasis>n/a</emphasis></entry>
<entry>string</entry> <entry>addresses to follow up to. Separate entries by a comma.</entry>
<entry>No</entry> </row>
<entry><emphasis>n/a</emphasis></entry> <row>
<entry>addresses to follow up to. <entry>extra</entry>
Separate entries by a comma.</entry> <entry>string</entry>
</row> <entry>No</entry>
<row> <entry><emphasis>n/a</emphasis></entry>
<entry>extra</entry> <entry>any extra information you want passed to the link, such
<entry>string</entry> as style sheet classes</entry>
<entry>No</entry> </row>
<entry><emphasis>n/a</emphasis></entry> </tbody>
<entry>any extra information you </tgroup>
want passed to the link, such </informaltable>
as style sheet classes</entry> <para>
</row> mailto automates the creation of mailto links and optionally
</tbody> encodes them. Encoding e-mails makes it more difficult for
</tgroup> web spiders to pick up e-mail addresses off of your site.
</informaltable> </para>
<para> <note>
mailto automates the creation of mailto links and optionally <title>Technical Note</title>
encodes them. Encoding e-mails makes it more difficult for <para>
web spiders to pick up e-mail addresses off of your site. javascript is probably the most thorough form of
</para> encoding, although you can use hex encoding too.
<note> </para>
<title>Technical Note</title> </note>
<para> <example>
javascript is probably the most thorough form of <title>mailto</title>
encoding, although you can use hex encoding too. <programlisting>
</para> {mailto address="me@example.com"}
</note> {mailto address="me@example.com" text="send me some mail"}
<example> {mailto address="me@example.com" encode="javascript"}
<title>mailto</title> {mailto address="me@example.com" encode="hex"}
<programlisting> {mailto address="me@example.com" subject="Hello to you!"}
{mailto address="me@domain.com"} {mailto address="me@example.com" cc="you@example.com,they@example.com"}
{mailto address="me@domain.com" text="send me some mail"} {mailto address="me@example.com" extra='class="email"'}
{mailto address="me@domain.com" encode="javascript"}
{mailto address="me@domain.com" encode="hex"}
{mailto address="me@domain.com" subject="Hello to you!"}
{mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
{mailto address="me@domain.com" extra='class="email"'}
OUTPUT: OUTPUT:
&lt;a href="mailto:me@domain.com" &gt;me@domain.com&lt;/a&gt; &lt;a href="mailto:me@example.com" &gt;me@example.com&lt;/a&gt;
&lt;a href="mailto:me@domain.com" &gt;send me some mail&lt;/a&gt; &lt;a href="mailto:me@example.com" &gt;send me some mail&lt;/a&gt;
&lt;script type="text/javascript" language="javascript"&gt;eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%6 &lt;script type="text/javascript" language="javascript"&gt;eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%6
9%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d% 9%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%
61%69%6e%2e%63%6f%6d%22%20%3e%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%3c%2f%61%3e 61%69%6e%2e%63%6f%6d%22%20%3e%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%3c%2f%61%3e
%27%29%3b'))&lt;/script&gt; %27%29%3b'))&lt;/script&gt;
&lt;a href="mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d" &gt;&#x6d;&#x65;&#x40;&#x64;&#x6f;&#x6d;&#x61;&#x69;&#x6e;&#x2e;&#x63;&#x6f;&#x6d;&lt;/a&gt; &lt;a href="mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d" &gt;&#x6d;&#x65;&#x40;&#x64;&#x6f;&#x6d;&#x61;&#x69;&#x6e;&#x2e;&#x63;&#x6f;&#x6d;&lt;/a&gt;
&lt;a href="mailto:me@domain.com?subject=Hello%20to%20you%21" &gt;me@domain.com&lt;/a&gt; &lt;a href="mailto:me@example.com?subject=Hello%20to%20you%21" &gt;me@example.com&lt;/a&gt;
&lt;a href="mailto:me@domain.com?cc=you@domain.com%2Cthey@domain.com" &gt;me@domain.com&lt;/a&gt; &lt;a href="mailto:me@example.com?cc=you@example.com%2Cthey@example.com" &gt;me@example.com&lt;/a&gt;
&lt;a href="mailto:me@domain.com" class="email"&gt;me@domain.com&lt;/a&gt;</programlisting> &lt;a href="mailto:me@example.com" class="email"&gt;me@example.com&lt;/a&gt;</programlisting>
</example> </example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
@@ -150,4 +145,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml vim: et tw=78 syn=sgml
vi: ts=1 sw=1 vi: ts=1 sw=1
--> -->

View File

@@ -1,411 +1,415 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.popup"> <sect1 id="language.function.popup">
<title>popup</title> <title>popup</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
<colspec colname="type" align="center" /> <colspec colname="type" align="center" />
<colspec colname="required" align="center" /> <colspec colname="required" align="center" />
<colspec colname="default" align="center" /> <colspec colname="default" align="center" />
<colspec colname="desc" /> <colspec colname="desc" />
<thead> <thead>
<row> <row>
<entry>Attribute Name</entry> <entry>Attribute Name</entry>
<entry>Type</entry> <entry>Type</entry>
<entry>Required</entry> <entry>Required</entry>
<entry>Default</entry> <entry>Default</entry>
<entry>Description</entry> <entry>Description</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>text</entry> <entry>text</entry>
<entry>string</entry> <entry>string</entry>
<entry>Yes</entry> <entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>the text/html to display in the popup window</entry> <entry>the text/html to display in the popup window</entry>
</row> </row>
<row> <row>
<entry>trigger</entry> <entry>trigger</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>onMouseOver</emphasis></entry> <entry><emphasis>onMouseOver</emphasis></entry>
<entry>What is used to trigger the popup window. Can be <entry>What is used to trigger the popup window. Can be
one of onMouseOver or onClick</entry> one of onMouseOver or onClick</entry>
</row> </row>
<row> <row>
<entry>sticky</entry> <entry>sticky</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>false</emphasis></entry> <entry><emphasis>false</emphasis></entry>
<entry>Makes the popup stick around until closed</entry> <entry>Makes the popup stick around until closed</entry>
</row> </row>
<row> <row>
<entry>caption</entry> <entry>caption</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the caption to title</entry> <entry>sets the caption to title</entry>
</row> </row>
<row> <row>
<entry>fgcolor</entry> <entry>fgcolor</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>color of the inside of the popup box</entry> <entry>color of the inside of the popup box</entry>
</row> </row>
<row> <row>
<entry>bgcolor</entry> <entry>bgcolor</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>color of the border of the popup box</entry> <entry>color of the border of the popup box</entry>
</row> </row>
<row> <row>
<entry>textcolor</entry> <entry>textcolor</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the color of the text inside the box</entry> <entry>sets the color of the text inside the box</entry>
</row> </row>
<row> <row>
<entry>capcolor</entry> <entry>capcolor</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets color of the box's caption</entry> <entry>sets color of the box's caption</entry>
</row> </row>
<row> <row>
<entry>closecolor</entry> <entry>closecolor</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the color of the close text</entry> <entry>sets the color of the close text</entry>
</row> </row>
<row> <row>
<entry>textfont</entry> <entry>textfont</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the font to be used by the main text</entry> <entry>sets the font to be used by the main text</entry>
</row> </row>
<row> <row>
<entry>captionfont</entry> <entry>captionfont</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the font of the caption</entry> <entry>sets the font of the caption</entry>
</row> </row>
<row> <row>
<entry>closefont</entry> <entry>closefont</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the font for the "Close" text</entry> <entry>sets the font for the "Close" text</entry>
</row> </row>
<row> <row>
<entry>textsize</entry> <entry>textsize</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the size of the main text's font</entry> <entry>sets the size of the main text's font</entry>
</row> </row>
<row> <row>
<entry>captionsize</entry> <entry>captionsize</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the size of the caption's font</entry> <entry>sets the size of the caption's font</entry>
</row> </row>
<row> <row>
<entry>closesize</entry> <entry>closesize</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the size of the "Close" text's font</entry> <entry>sets the size of the "Close" text's font</entry>
</row> </row>
<row> <row>
<entry>width</entry> <entry>width</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the width of the box</entry> <entry>sets the width of the box</entry>
</row> </row>
<row> <row>
<entry>height</entry> <entry>height</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the height of the box</entry> <entry>sets the height of the box</entry>
</row> </row>
<row> <row>
<entry>left</entry> <entry>left</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>false</emphasis></entry> <entry><emphasis>false</emphasis></entry>
<entry>makes the popups go to the left of the mouse</entry> <entry>makes the popups go to the left of the mouse</entry>
</row> </row>
<row> <row>
<entry>right</entry> <entry>right</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>false</emphasis></entry> <entry><emphasis>false</emphasis></entry>
<entry>makes the popups go to the right of the mouse</entry> <entry>makes the popups go to the right of the mouse</entry>
</row> </row>
<row> <row>
<entry>center</entry> <entry>center</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>false</emphasis></entry> <entry><emphasis>false</emphasis></entry>
<entry>makes the popups go to the center of the mouse</entry> <entry>makes the popups go to the center of the mouse</entry>
</row> </row>
<row> <row>
<entry>above</entry> <entry>above</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>false</emphasis></entry> <entry><emphasis>false</emphasis></entry>
<entry>makes the popups go above the mouse. NOTE: only <entry>makes the popups go above the mouse. NOTE: only
possible when height has been set</entry> possible when height has been set</entry>
</row> </row>
<row> <row>
<entry>below</entry> <entry>below</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>false</emphasis></entry> <entry><emphasis>false</emphasis></entry>
<entry>makes the popups go below the mouse</entry> <entry>makes the popups go below the mouse</entry>
</row> </row>
<row> <row>
<entry>border</entry> <entry>border</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>makes the border of the popups thicker or thinner</entry> <entry>makes the border of the popups thicker or thinner</entry>
</row> </row>
<row> <row>
<entry>offsetx</entry> <entry>offsetx</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>how far away from the pointer the popup will show <entry>how far away from the pointer the popup will show
up, horizontally</entry> up, horizontally</entry>
</row> </row>
<row> <row>
<entry>offsety</entry> <entry>offsety</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>how far away from the pointer the popup will show <entry>how far away from the pointer the popup will show
up, vertically</entry> up, vertically</entry>
</row> </row>
<row> <row>
<entry>fgbackground</entry> <entry>fgbackground</entry>
<entry>url to image</entry> <entry>url to image</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>defines a picture to use instead of color for the <entry>defines a picture to use instead of color for the
inside of the popup.</entry> inside of the popup.</entry>
</row> </row>
<row> <row>
<entry>bgbackground</entry> <entry>bgbackground</entry>
<entry>url to image</entry> <entry>url to image</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>defines a picture to use instead of color for the <entry>defines a picture to use instead of color for the
border of the popup. NOTE: You will want to set bgcolor border of the popup. NOTE: You will want to set bgcolor
to "" or the color will show as well. NOTE: When having to "" or the color will show as well. NOTE: When having
a Close link, Netscape will re-render the table cells, a Close link, Netscape will re-render the table cells,
making things look incorrect</entry> making things look incorrect</entry>
</row> </row>
<row> <row>
<entry>closetext</entry> <entry>closetext</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the "Close" text to something else</entry> <entry>sets the "Close" text to something else</entry>
</row> </row>
<row> <row>
<entry>noclose</entry> <entry>noclose</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>does not display the "Close" text on stickies <entry>does not display the "Close" text on stickies
with a caption</entry> with a caption</entry>
</row> </row>
<row> <row>
<entry>status</entry> <entry>status</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the text in the browsers status bar</entry> <entry>sets the text in the browsers status bar</entry>
</row> </row>
<row> <row>
<entry>autostatus</entry> <entry>autostatus</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the status bar's text to the popup's text. <entry>sets the status bar's text to the popup's text.
NOTE: overrides status setting</entry> NOTE: overrides status setting</entry>
</row> </row>
<row> <row>
<entry>autostatuscap</entry> <entry>autostatuscap</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets the status bar's text to the caption's text. <entry>sets the status bar's text to the caption's text.
NOTE: overrides status and autostatus settings</entry> NOTE: overrides status and autostatus settings</entry>
</row> </row>
<row> <row>
<entry>inarray</entry> <entry>inarray</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>tells overLib to read text from this index in <entry>tells overLib to read text from this index in
the ol_text array, located in overlib.js. This the ol_text array, located in overlib.js. This
parameter can be used instead of text</entry> parameter can be used instead of text</entry>
</row> </row>
<row> <row>
<entry>caparray</entry> <entry>caparray</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>tells overLib to read the caption from this index <entry>tells overLib to read the caption from this index
in the ol_caps array</entry> in the ol_caps array</entry>
</row> </row>
<row> <row>
<entry>capicon</entry> <entry>capicon</entry>
<entry>url</entry> <entry>url</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>displays the image given before the popup caption</entry> <entry>displays the image given before the popup caption</entry>
</row> </row>
<row> <row>
<entry>snapx</entry> <entry>snapx</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>snaps the popup to an even position in a <entry>snaps the popup to an even position in a
horizontal grid</entry> horizontal grid</entry>
</row> </row>
<row> <row>
<entry>snapy</entry> <entry>snapy</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>snaps the popup to an even position in a <entry>snaps the popup to an even position in a
vertical grid</entry> vertical grid</entry>
</row> </row>
<row> <row>
<entry>fixx</entry> <entry>fixx</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>locks the popups horizontal position Note: <entry>locks the popups horizontal position Note:
overrides all other horizontal placement</entry> overrides all other horizontal placement</entry>
</row> </row>
<row> <row>
<entry>fixy</entry> <entry>fixy</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>locks the popups vertical position Note: <entry>locks the popups vertical position Note:
overrides all other vertical placement</entry> overrides all other vertical placement</entry>
</row> </row>
<row> <row>
<entry>background</entry> <entry>background</entry>
<entry>url</entry> <entry>url</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>sets image to be used instead of table box <entry>sets image to be used instead of table box
background</entry> background</entry>
</row> </row>
<row> <row>
<entry>padx</entry> <entry>padx</entry>
<entry>integer,integer</entry> <entry>integer,integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>pads the background image with horizontal <entry>pads the background image with horizontal
whitespace for text placement. Note: this is a two whitespace for text placement. Note: this is a two
parameter command</entry> parameter command</entry>
</row> </row>
<row> <row>
<entry>pady</entry> <entry>pady</entry>
<entry>integer,integer</entry> <entry>integer,integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>pads the background image with vertical <entry>pads the background image with vertical
whitespace for text placement. Note: this is a two whitespace for text placement. Note: this is a two
parameter command</entry> parameter command</entry>
</row> </row>
<row> <row>
<entry>fullhtml</entry> <entry>fullhtml</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>allows you to control the html over a background <entry>allows you to control the html over a background
picture completely. The html code is expected in the "text" picture completely. The html code is expected in the "text"
attribute</entry> attribute</entry>
</row> </row>
<row> <row>
<entry>frame</entry> <entry>frame</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>controls popups in a different frame. See the <entry>controls popups in a different frame. See the
overlib page for more info on this function</entry> overlib page for more info on this function</entry>
</row> </row>
<row> <row>
<entry>timeout</entry> <entry>timeout</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>calls the specified javascript function and takes <entry>calls the specified javascript function and takes
the return value as the text that should be displayed in the return value as the text that should be displayed in
the popup window</entry> the popup window</entry>
</row> </row>
<row> <row>
<entry>delay</entry> <entry>delay</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>makes that popup behave like a tooltip. It will <entry>makes that popup behave like a tooltip. It will
popup only after this delay in milliseconds</entry> popup only after this delay in milliseconds</entry>
</row> </row>
<row> <row>
<entry>hauto</entry> <entry>hauto</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>automatically determine if the popup should be to <entry>automatically determine if the popup should be to
the left or right of the mouse.</entry> the left or right of the mouse.</entry>
</row> </row>
<row> <row>
<entry>vauto</entry> <entry>vauto</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>automatically determine if the popup should be <entry>automatically determine if the popup should be
above or below the mouse.</entry> above or below the mouse.</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
popup is used to create javascript popup windows. popup is used to create javascript popup windows.
</para> </para>
<example> <example>
<title>popup</title> <title>popup</title>
<programlisting> <programlisting>
<![CDATA[
{* popup_init must be called once at the top of the page *} {* popup_init must be called once at the top of the page *}
{popup_init src="/javascripts/overlib.js"} {popup_init src="/javascripts/overlib.js"}
{* create a link with a popup window when you move your mouse over *} {* create a link with a popup window when you move your mouse over *}
&lt;A href="mypage.html" {popup text="This link takes you to my page!"}&gt;mypage&lt;/A&gt; <a href="mypage.html" {popup text="This link takes you to my page!"}>mypage</a>
{* you can use html, links, etc in your popup text *} {* you can use html, links, etc in your popup text *}
&lt;A href="mypage.html" {popup sticky=true caption="mypage contents" <a href="mypage.html" {popup sticky=true caption="mypage contents"
text="&lt;UL&gt;&lt;LI&gt;links&lt;LI&gt;pages&lt;LI&gt;images&lt;/UL&gt;" snapx=10 snapy=10}&gt;mypage&lt;/A&gt;</programlisting> text="<ul><li>links</li><li>pages</li><li>images</li></ul>" snapx=10
</example> snapy=10}>mypage</a>
]]>
</programlisting>
</example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -18,7 +18,7 @@
<title>displaying request variables</title> <title>displaying request variables</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{* display value of page from URL (GET) http://www.domain.com/index.php?page=foo *} {* display value of page from URL (GET) http://www.example.com/index.php?page=foo *}
{$smarty.get.page} {$smarty.get.page}
{* display the variable "page" from a form (POST) *} {* display the variable "page" from a form (POST) *}

View File

@@ -9,12 +9,15 @@
Smarty is a template engine for PHP. More specifically, it facilitates a Smarty is a template engine for PHP. More specifically, it facilitates a
manageable way to separate application logic and content from its manageable way to separate application logic and content from its
presentation. This is best described in a situation where the application presentation. This is best described in a situation where the application
programmer and the template designer play different roles, or in most cases programmer and the template designer play different roles, or in most
are not the same person. For example, let's say you are creating a web page cases are not the same person.
that is displaying a newspaper article. The article headline, tagline, </para>
author and body are content elements, they contain no information about how <para>
they will be presented. They are passed into Smarty by the application, For example, let's say you are creating a web page that is displaying a
then the template designer edits the templates and uses a combination of newspaper article. The article headline, tagline, author and body are
content elements, they contain no information about how they will be
presented. They are passed into Smarty by the application, then the
template designer edits the templates and uses a combination of
HTML tags and template tags to format the presentation of these elements HTML tags and template tags to format the presentation of these elements
(HTML tables, background colors, font sizes, style sheets, etc.) One day (HTML tables, background colors, font sizes, style sheets, etc.) One day
the programmer needs to change the way the article content is retrieved (a the programmer needs to change the way the article content is retrieved (a
@@ -35,16 +38,16 @@
presentation logic. This does not mean that Smarty forces a separation of presentation logic. This does not mean that Smarty forces a separation of
business and presentation logic. Smarty has no knowledge of which is which, business and presentation logic. Smarty has no knowledge of which is which,
so placing business logic in the template is your own doing. Also, if you so placing business logic in the template is your own doing. Also, if you
desire NO logic in your templates you certainly can do so by boiling the desire <emphasis>no</emphasis> logic in your templates you certainly can
content down to text and variables only. do so by boiling the content down to text and variables only.
</para> </para>
<para> <para>
One of the unique aspects about Smarty is the template compiling. This means One of the unique aspects about Smarty is the template compiling. This
Smarty reads the template files and creates PHP scripts from them. Once means Smarty reads the template files and creates PHP scripts from them.
they are created, they are executed from then on. Therefore there is no Once they are created, they are executed from then on. Therefore there is
costly template file parsing for each request, and each template can take no costly template file parsing for each request, and each template can
full advantage of PHP compiler cache solutions such as Zend Accelerator take full advantage of PHP compiler cache solutions such as Zend
(<ulink url="&url.zend;">&url.zend;</ulink>) or PHP Accelerator Accelerator (<ulink url="&url.zend;">&url.zend;</ulink>) or PHP Accelerator
(<ulink url="&url.php-accelerator;">&url.php-accelerator;</ulink>). (<ulink url="&url.php-accelerator;">&url.php-accelerator;</ulink>).
</para> </para>
<para> <para>
@@ -73,8 +76,10 @@
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
You can make <link linkend="language.custom.functions">custom functions</link> You can make <link
and custom <link linkend="language.modifiers">variable modifiers</link>, so the linkend="language.custom.functions">custom functions</link>
and custom <link
linkend="language.modifiers">variable modifiers</link>, so the
template language is extremely extensible. template language is extremely extensible.
</para> </para>
</listitem> </listitem>
@@ -87,8 +92,8 @@
<listitem> <listitem>
<para> <para>
The if/elseif/else/endif constructs are passed to the The if/elseif/else/endif constructs are passed to the
PHP parser, so the {if ...} expression syntax can be as simple or as complex PHP parser, so the {if ...} expression syntax can be as simple or as
as you like. complex as you like.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
@@ -98,9 +103,9 @@
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
It is possible to embed PHP code right in your template files, It is possible to embed PHP code right in your template files, although
although this may not be needed (nor recommended) this may not be needed (nor recommended) since the engine is so
since the engine is so customizable. customizable.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
@@ -160,9 +165,9 @@ debug.tpl
Smarty uses a PHP constant named <link Smarty uses a PHP constant named <link
linkend="constant.smarty.dir">SMARTY_DIR</link> which is the system linkend="constant.smarty.dir">SMARTY_DIR</link> which is the system
filepath Smarty library directory. Basically, if your application can find filepath Smarty library directory. Basically, if your application can find
the <emphasis>Smarty.class.php</emphasis> file, you do not need to set the <filename>Smarty.class.php</filename> file, you do not need to set
SMARTY_DIR, Smarty will figure it out on its own. Therefore, if SMARTY_DIR, Smarty will figure it out on its own. Therefore, if
<emphasis>Smarty.class.php</emphasis> is not in your include_path, or you <filename>Smarty.class.php</filename> is not in your include_path, or you
do not supply an absolute path to it in your application, then you must do not supply an absolute path to it in your application, then you must
define SMARTY_DIR manually. SMARTY_DIR <emphasis>must</emphasis> include a define SMARTY_DIR manually. SMARTY_DIR <emphasis>must</emphasis> include a
trailing slash. trailing slash.
@@ -185,7 +190,7 @@ $smarty = new Smarty;
<para> <para>
Try running the above script. If you get an error saying the Try running the above script. If you get an error saying the
<emphasis>Smarty.class.php</emphasis> file could not be found, you have to <filename>Smarty.class.php</filename> file could not be found, you have to
do one of the following: do one of the following:
</para> </para>
@@ -232,18 +237,20 @@ $smarty = new Smarty;
<para> <para>
Now that the library files are in place, it's time to setup the Smarty Now that the library files are in place, it's time to setup the Smarty
directories for your application. Smarty requires four directories which directories for your application. Smarty requires four directories which
are (by default) named <emphasis>templates</emphasis>, are (by default) named <filename class="directory">templates</filename>,
<emphasis>templates_c</emphasis>, <emphasis>configs</emphasis> and <filename class="directory">templates_c</filename>, <filename
<emphasis>cache</emphasis>. Each of these are definable by the Smarty class class="directory">configs</filename> and <filename
properties <emphasis>$template_dir</emphasis>, class="directory">cache</filename>. Each of these are definable by the
<emphasis>$compile_dir</emphasis>, <emphasis>$config_dir</emphasis>, and Smarty class properties <varname>$template_dir</varname>,
<emphasis>$cache_dir</emphasis> respectively. It is highly recommended <varname>$compile_dir</varname>, <varname>$config_dir</varname>, and
<varname>$cache_dir</varname> respectively. It is highly recommended
that you setup a separate set of these directories for each application that you setup a separate set of these directories for each application
that will use Smarty. that will use Smarty.
</para> </para>
<para> <para>
Be sure you know the location of your web server document root. In our Be sure you know the location of your web server document root. In our
example, the document root is "/web/www.mydomain.com/docs/". The Smarty example, the document root is <filename
class="directory">/web/www.example.com/docs/</filename>. The Smarty
directories are only accessed by the Smarty library and never accessed directories are only accessed by the Smarty library and never accessed
directly by the web browser. Therefore to avoid any security concerns, it directly by the web browser. Therefore to avoid any security concerns, it
is recommended to place these directories <emphasis>outside</emphasis> of is recommended to place these directories <emphasis>outside</emphasis> of
@@ -255,13 +262,14 @@ $smarty = new Smarty;
of a directory naming convention. You can use the same environment for any of a directory naming convention. You can use the same environment for any
application, just replace "guestbook" with the name of your app. We'll application, just replace "guestbook" with the name of your app. We'll
place our Smarty directories under place our Smarty directories under
"/web/www.mydomain.com/smarty/guestbook/". <filename
class="directory">/web/www.example.com/smarty/guestbook/</filename>.
</para> </para>
<para> <para>
You will need as least one file under your document root, and that is the You will need as least one file under your document root, and that is the
script accessed by the web browser. We will call our script "index.php", script accessed by the web browser. We will call our script
and place it in a subdirectory under the document root called <filename>index.php</filename>, and place it in a subdirectory under the
"/guestbook/". document root called <filename class="directory">/guestbook/</filename>.
</para> </para>
<note> <note>
@@ -269,7 +277,7 @@ $smarty = new Smarty;
<para> <para>
It is convenient to setup the web server so that "index.php" can be It is convenient to setup the web server so that "index.php" can be
identified as the default directory index, so if you access identified as the default directory index, so if you access
"http://www.mydomain.com/guestbook/", the index.php script will be executed "http://www.example.com/guestbook/", the index.php script will be executed
without "index.php" in the URL. In Apache you can set this up by adding without "index.php" in the URL. In Apache you can set this up by adding
"index.php" onto the end of your DirectoryIndex setting (separate each "index.php" onto the end of your DirectoryIndex setting (separate each
entry with a space.) entry with a space.)
@@ -291,12 +299,12 @@ $smarty = new Smarty;
/usr/local/lib/php/Smarty/internals/*.php /usr/local/lib/php/Smarty/internals/*.php
/usr/local/lib/php/Smarty/plugins/*.php /usr/local/lib/php/Smarty/plugins/*.php
/web/www.mydomain.com/smarty/guestbook/templates/ /web/www.example.com/smarty/guestbook/templates/
/web/www.mydomain.com/smarty/guestbook/templates_c/ /web/www.example.com/smarty/guestbook/templates_c/
/web/www.mydomain.com/smarty/guestbook/configs/ /web/www.example.com/smarty/guestbook/configs/
/web/www.mydomain.com/smarty/guestbook/cache/ /web/www.example.com/smarty/guestbook/cache/
/web/www.mydomain.com/docs/guestbook/index.php /web/www.example.com/docs/guestbook/index.php
]]> ]]>
</screen> </screen>
</example> </example>
@@ -314,11 +322,11 @@ $smarty = new Smarty;
<title>Setting file permissions</title> <title>Setting file permissions</title>
<programlisting role="shell"> <programlisting role="shell">
<![CDATA[ <![CDATA[
chown nobody:nobody /web/www.mydomain.com/smarty/guestbook/templates_c/ chown nobody:nobody /web/www.example.com/smarty/guestbook/templates_c/
chmod 770 /web/www.mydomain.com/smarty/guestbook/templates_c/ chmod 770 /web/www.example.com/smarty/guestbook/templates_c/
chown nobody:nobody /web/www.mydomain.com/smarty/guestbook/cache/ chown nobody:nobody /web/www.example.com/smarty/guestbook/cache/
chmod 770 /web/www.mydomain.com/smarty/guestbook/cache/ chmod 770 /web/www.example.com/smarty/guestbook/cache/
]]> ]]>
</programlisting> </programlisting>
</example> </example>
@@ -339,7 +347,7 @@ chmod 770 /web/www.mydomain.com/smarty/guestbook/cache/
</para> </para>
<example> <example>
<title>Editing /web/www.mydomain.com/smarty/guestbook/templates/index.tpl</title> <title>Editing /web/www.example.com/smarty/guestbook/templates/index.tpl</title>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -369,7 +377,7 @@ Hello, {$name}!
</para> </para>
<example> <example>
<title>Editing /web/www.mydomain.com/docs/guestbook/index.php</title> <title>Editing /web/www.example.com/docs/guestbook/index.php</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -379,10 +387,10 @@ require('Smarty.class.php');
$smarty = new Smarty; $smarty = new Smarty;
$smarty->template_dir = '/web/www.mydomain.com/smarty/guestbook/templates/'; $smarty->template_dir = '/web/www.example.com/smarty/guestbook/templates/';
$smarty->compile_dir = '/web/www.mydomain.com/smarty/guestbook/templates_c/'; $smarty->compile_dir = '/web/www.example.com/smarty/guestbook/templates_c/';
$smarty->config_dir = '/web/www.mydomain.com/smarty/guestbook/configs/'; $smarty->config_dir = '/web/www.example.com/smarty/guestbook/configs/';
$smarty->cache_dir = '/web/www.mydomain.com/smarty/guestbook/cache/'; $smarty->cache_dir = '/web/www.example.com/smarty/guestbook/cache/';
$smarty->assign('name','Ned'); $smarty->assign('name','Ned');
@@ -396,17 +404,18 @@ $smarty->display('index.tpl');
<title>Technical Note</title> <title>Technical Note</title>
<para> <para>
In our example, we are setting absolute paths to all of the Smarty In our example, we are setting absolute paths to all of the Smarty
directories. If '/web/www.mydomain.com/smarty/guestbook/' is within your directories. If <filename
PHP include_path, then these settings are not necessary. However, it is class="directory">/web/www.example.com/smarty/guestbook/</filename> is
more efficient and (from experience) less error-prone to set them to within your PHP include_path, then these settings are not necessary.
absolute paths. This ensures that Smarty is getting files from the However, it is more efficient and (from experience) less error-prone to
directories you intended. set them to absolute paths. This ensures that Smarty is getting files
from the directories you intended.
</para> </para>
</note> </note>
<para> <para>
Now load the index.php file from your web browser. You should see "Hello, Now load the <filename>index.php</filename> file from your web browser.
Ned!" You should see "Hello, Ned!"
</para> </para>
<para> <para>
You have completed the basic setup for Smarty! You have completed the basic setup for Smarty!
@@ -425,8 +434,9 @@ $smarty->display('index.tpl');
initialize your Smarty environment. So instead of repeatedly setting initialize your Smarty environment. So instead of repeatedly setting
directory paths, assigning the same vars, etc., we can do that in one place. directory paths, assigning the same vars, etc., we can do that in one place.
Lets create a new directory "/php/includes/guestbook/" and make a new file Lets create a new directory "/php/includes/guestbook/" and make a new file
called "setup.php". In our example environment, "/php/includes" is in our called <filename>setup.php</filename>. In our example environment,
include_path. Be sure you set this up too, or use absolute file paths. "/php/includes" is in our include_path. Be sure you set this up too, or
use absolute file paths.
</para> </para>
<example> <example>
@@ -448,17 +458,18 @@ class Smarty_GuestBook extends Smarty {
function Smarty_GuestBook() function Smarty_GuestBook()
{ {
// Class Constructor. These automatically get set with each new instance. // Class Constructor.
// These automatically get set with each new instance.
$this->Smarty(); $this->Smarty();
$this->template_dir = '/web/www.mydomain.com/smarty/guestbook/templates/'; $this->template_dir = '/web/www.example.com/smarty/guestbook/templates/';
$this->compile_dir = '/web/www.mydomain.com/smarty/guestbook/templates_c/'; $this->compile_dir = '/web/www.example.com/smarty/guestbook/templates_c/';
$this->config_dir = '/web/www.mydomain.com/smarty/guestbook/configs/'; $this->config_dir = '/web/www.example.com/smarty/guestbook/configs/';
$this->cache_dir = '/web/www.mydomain.com/smarty/guestbook/cache/'; $this->cache_dir = '/web/www.example.com/smarty/guestbook/cache/';
$this->caching = true; $this->caching = true;
$this->assign('app_name','Guest Book'); $this->assign('app_name', 'Guest Book');
} }
} }
@@ -472,7 +483,7 @@ class Smarty_GuestBook extends Smarty {
</para> </para>
<example> <example>
<title>Editing /web/www.mydomain.com/docs/guestbook/index.php</title> <title>Editing /web/www.example.com/docs/guestbook/index.php</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -491,7 +502,8 @@ $smarty->display('index.tpl');
<para> <para>
Now you see it is quite simple to bring up an instance of Smarty, just use Now you see it is quite simple to bring up an instance of Smarty, just use
Smarty_GuestBook which automatically initializes everything for our application. Smarty_GuestBook which automatically initializes everything for our
application.
</para> </para>
</sect1> </sect1>

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="advanced.features.objects"> <sect1 id="advanced.features.objects">
<title>Objects</title> <title>Objects</title>
<para> <para>
Smarty allows access to PHP objects through the templates. There are Smarty allows access to PHP objects through the templates. There are
two ways to access them. One way is to register objects to the template, two ways to access them. One way is to register objects to the template,
then use access them via syntax similar to custom functions. The other way then use access them via syntax similar to custom functions. The other way
is to assign objects to the templates and access them much like any other is to assign objects to the templates and access them much like any other
@@ -13,41 +13,41 @@
or assigned in arrays of objects, etc. The method you choose will be or assigned in arrays of objects, etc. The method you choose will be
determined by your needs, but use the first method whenever possible to determined by your needs, but use the first method whenever possible to
keep template syntax to a minimum. keep template syntax to a minimum.
</para> </para>
<para> <para>
If security is enabled, no private methods or functions can be accessed If security is enabled, no private methods or functions can be accessed
(begininning with "_"). If a method and property of the same name exist, (begininning with "_"). If a method and property of the same name exist,
the method will be used. the method will be used.
</para> </para>
<para> <para>
You can restrict the methods and properties that can be accessed by You can restrict the methods and properties that can be accessed by
listing them in an array as the third registration parameter. listing them in an array as the third registration parameter.
</para> </para>
<para> <para>
By default, parameters passed to objects through the templates are passed By default, parameters passed to objects through the templates are passed
the same way custom functions get them. An associative array is passed the same way custom functions get them. An associative array is passed
as the first parameter, and the smarty object as the second. If you want as the first parameter, and the smarty object as the second. If you want
the parameters passed one at a time for each argument like traditional the parameters passed one at a time for each argument like traditional
object parameter passing, set the fourth registration parameter to false. object parameter passing, set the fourth registration parameter to false.
</para> </para>
<para> <para>
The optional fifth parameter has only effect with The optional fifth parameter has only effect with
<parameter>format</parameter> being <literal>true</literal> <parameter>format</parameter> being <literal>true</literal>
and contains a list ob methods that should be treated as and contains a list ob methods that should be treated as
blocks. That means these methods have a closing tag in the blocks. That means these methods have a closing tag in the
template template
(<literal>{foobar->meth2}...{/foobar->meth2}</literal>) and (<literal>{foobar->meth2}...{/foobar->meth2}</literal>) and
the parameters to the methods have the same synopsis as the the parameters to the methods have the same synopsis as the
parameters for block-function-plugins: They get 4 parameters parameters for block-function-plugins: They get 4 parameters
<parameter>$params</parameter>, <parameter>$params</parameter>,
<parameter>$content</parameter>, <parameter>$content</parameter>,
<parameter>&amp;$smarty</parameter> and <parameter>&amp;$smarty</parameter> and
<parameter>&amp;$repeat</parameter> and they also behave like <parameter>&amp;$repeat</parameter> and they also behave like
block-function-plugins. block-function-plugins.
</para> </para>
<example> <example>
<title>using a registered or assigned object</title> <title>using a registered or assigned object</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
// the object // the object
@@ -71,9 +71,13 @@ $smarty->assign_by_ref("myobj", $myobj);
$smarty->display("index.tpl"); $smarty->display("index.tpl");
?> ?>
]]>
TEMPLATE: </programlisting>
<para>
And here's how to access your objects in index.tpl:
</para>
<programlisting>
<![CDATA[
{* access our registered object *} {* access our registered object *}
{foobar->meth1 p1="foo" p2=$bar} {foobar->meth1 p1="foo" p2=$bar}
@@ -84,8 +88,8 @@ the output was {$output}
{* access our assigned object *} {* access our assigned object *}
{$myobj->meth1("foo",$bar)} {$myobj->meth1("foo",$bar)}
]]> ]]>
</programlisting> </programlisting>
</example> </example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
@@ -106,4 +110,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml vim: et tw=78 syn=sgml
vi: ts=1 sw=1 vi: ts=1 sw=1
--> -->

View File

@@ -42,7 +42,7 @@ $smarty->display("index.tpl");
// a simple protection against spambots // a simple protection against spambots
?> ?>
]]> ]]>
</programlisting> </programlisting>
</example> </example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
@@ -64,4 +64,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml vim: et tw=78 syn=sgml
vi: ts=1 sw=1 vi: ts=1 sw=1
--> -->

View File

@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="advanced.features.postfilters"> <sect1 id="advanced.features.postfilters">
<title>Postfilters</title> <title>Postfilters</title>
<para> <para>
Template postfilters are PHP functions that your templates are ran through Template postfilters are PHP functions that your templates are ran through
after they are compiled. Postfilters can be either after they are compiled. Postfilters can be either
<link linkend="api.register.postfilter">registered</link> or loaded <link linkend="api.register.postfilter">registered</link> or loaded
from the plugins directory by using from the plugins directory by using
<link linkend="api.load.filter">load_filter()</link> function or by <link linkend="api.load.filter">load_filter()</link> function or by
setting setting
<link linkend="variable.autoload.filters">$autoload_filters</link> <link linkend="variable.autoload.filters">$autoload_filters</link>
variable. Smarty will pass the compiled template code as the first variable. Smarty will pass the compiled template code as the first
argument, and expect the function to return the result of the argument, and expect the function to return the result of the
processing. processing.
</para> </para>
<example> <example>
<title>using a template postfilter</title> <title>using a template postfilter</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
// put this in your application // put this in your application
@@ -29,13 +29,18 @@ function add_header_comment($tpl_source, &$smarty)
$smarty->register_postfilter("add_header_comment"); $smarty->register_postfilter("add_header_comment");
$smarty->display("index.tpl"); $smarty->display("index.tpl");
?> ?>
]]>
{* compiled Smarty template index.tpl *} </programlisting>
<para>
This will make the compiled Smarty template index.tpl look like:
</para>
<screen>
<![CDATA[
<!-- Created by Smarty! --> <!-- Created by Smarty! -->
{* rest of template content... *} {* rest of template content... *}
]]> ]]>
</programlisting> </screen>
</example> </example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
@@ -56,4 +61,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml vim: et tw=78 syn=sgml
vi: ts=1 sw=1 vi: ts=1 sw=1
--> -->

View File

@@ -1,23 +1,28 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="advanced.features.prefilters"> <sect1 id="advanced.features.prefilters">
<title>Prefilters</title> <title>Prefilters</title>
<para> <para>
Template prefilters are PHP functions that your templates are ran through Template prefilters are PHP functions that your templates are ran through
before they are compiled. This is good for preprocessing your templates before they are compiled. This is good for preprocessing your templates
to remove unwanted comments, keeping an eye on what people are putting to remove unwanted comments, keeping an eye on what people are putting
in their templates, etc. Prefilters can be either in their templates, etc.
<link linkend="api.register.prefilter">registered</link> or loaded from </para>
the plugins directory by using <para>
<link linkend="api.load.filter">load_filter()</link> function or by Prefilters can be either <link
setting linkend="api.register.prefilter">registered</link> or loaded from
<link linkend="variable.autoload.filters">$autoload_filters</link> variable. the plugins directory by using <link
Smarty will pass the template source code as the first argument, and linkend="api.load.filter">load_filter()</link> function or by setting
expect the function to return the resulting template source code. the <link linkend="variable.autoload.filters">$autoload_filters</link>
</para> variable.
<example> </para>
<title>using a template prefilter</title> <para>
<programlisting role="php"> Smarty will pass the template source code as the first argument, and
expect the function to return the resulting template source code.
</para>
<example>
<title>using a template prefilter</title>
<programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
// put this in your application // put this in your application
@@ -30,12 +35,12 @@ function remove_dw_comments($tpl_source, &$smarty)
$smarty->register_prefilter("remove_dw_comments"); $smarty->register_prefilter("remove_dw_comments");
$smarty->display("index.tpl"); $smarty->display("index.tpl");
?> ?>
{* Smarty template index.tpl *}
<!--# this line will get removed by the prefilter -->
]]> ]]>
</programlisting> </programlisting>
</example> <para>
This will remove all the comments in the template source.
</para>
</example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
@@ -56,4 +61,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml vim: et tw=78 syn=sgml
vi: ts=1 sw=1 vi: ts=1 sw=1
--> -->

View File

@@ -3,12 +3,12 @@
<sect1 id="template.resources"> <sect1 id="template.resources">
<title>Resources</title> <title>Resources</title>
<para> <para>
The templates may come from a variety of sources. When you display or fetch The templates may come from a variety of sources. When you display or fetch
a template, or when you include a template from within another template, a template, or when you include a template from within another template,
you supply a resource type, followed by the appropriate path and template you supply a resource type, followed by the appropriate path and template
name. If a resource is not explicitly given the value of <link name. If a resource is not explicitly given the value of <link
linkend="variable.default.resource.type">$default_resource_type</link> is linkend="variable.default.resource.type">$default_resource_type</link> is
assumed. assumed.
</para> </para>
<sect2 id="templates.from.template.dir"> <sect2 id="templates.from.template.dir">
<title>Templates from $template_dir</title> <title>Templates from $template_dir</title>
@@ -228,4 +228,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml vim: et tw=78 syn=sgml
vi: ts=1 sw=1 vi: ts=1 sw=1
--> -->