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"?>
<!-- $Revision$ -->
<chapter id="resources">
<title>Resources</title>
<para>
Smarty's homepage is located at <ulink
url="&url.smarty;">&url.smarty;</ulink>.
You can join the mailing list by sending an e-mail to
&ml.general.sub;. An archive of the mailing list can
be viewed at <ulink url="&url.ml.archive;">&url.ml.archive;</ulink>.
</para>
<chapter id="resources">
<title>Resources</title>
<para>
Smarty's homepage is located at <ulink
url="&url.smarty;">&url.smarty;</ulink>.
You can join the mailing list by sending an e-mail to
&ml.general.sub;. An archive of the mailing list can
be viewed at <ulink url="&url.ml.archive;">&url.ml.archive;</ulink>.
</para>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:

View File

@@ -240,22 +240,22 @@ function insert_header($params)
<!-- begin new wml deck -->
<wml>
<!-- begin first card -->
<card>
<do type="accept">
<go href="#two"/>
</do>
<p>
Welcome to WAP with Smarty!
Press OK to continue...
</p>
</card>
<!-- begin second card -->
<card id="two">
<p>
Pretty easy isn't it?
</p>
</card>
<!-- begin first card -->
<card>
<do type="accept">
<go href="#two"/>
</do>
<p>
Welcome to WAP with Smarty!
Press OK to continue...
</p>
</card>
<!-- begin second card -->
<card id="two">
<p>
Pretty easy isn't it?
</p>
</card>
</wml>
]]>
</programlisting>
@@ -307,10 +307,7 @@ function smarty_function_load_ticker($params, &$smarty)
</programlisting>
<programlisting>
<![CDATA[
index.tpl
---------
{* Smarty *}
{* in index.tpl *}
{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>
<programlisting>
<![CDATA[
index.tpl
---------
{* in index.tpl *}
Send inquiries to
{mailto address=$EmailAddress encode="javascript" subject="Hello"}

View File

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

View File

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

View File

@@ -79,7 +79,7 @@
{* 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>
<para>
Use the syntax for <link

View File

@@ -174,21 +174,21 @@ name: John Smith&lt;br&gt;
address: 253 N 45th&lt;br&gt;
home 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;
id: 1001&lt;br&gt;
name: Jack Jones&lt;br&gt;
address: 417 Mulberry ln&lt;br&gt;
home 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;
id: 1002&lt;br&gt;
name: Jane Munson&lt;br&gt;
address: 5605 apple st&lt;br&gt;
home 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>
</example>
@@ -210,15 +210,15 @@ OUTPUT:
name: John Smith&lt;br&gt;
home: 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;
home 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;
home 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>

View File

@@ -44,7 +44,7 @@
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>
</example>

View File

@@ -71,13 +71,13 @@
<programlisting>
<![CDATA[
{* 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 *}
{fetch file="http://www.myweather.com/68502/"}
{* 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 *}
{fetch file="http://www.myweather.com/68502/" assign="weather"}

View File

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

View File

@@ -1,134 +1,129 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.mailto">
<title>mailto</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
<colspec colname="type" align="center" />
<colspec colname="required" align="center" />
<colspec colname="default" align="center" />
<colspec colname="desc" />
<thead>
<row>
<entry>Attribute Name</entry>
<entry>Type</entry>
<entry>Required</entry>
<entry>Default</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>address</entry>
<entry>string</entry>
<entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the e-mail address</entry>
</row>
<row>
<entry>text</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the text to display, default is
the e-mail address</entry>
</row>
<row>
<entry>encode</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>none</emphasis></entry>
<entry>How to encode the e-mail.
Can be one of none,
hex or javascript.</entry>
</row>
<row>
<entry>cc</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>e-mail addresses to carbon copy.
Separate entries by a comma.</entry>
</row>
<row>
<entry>bcc</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>e-mail addresses to blind carbon copy.
Separate entries by a comma.</entry>
</row>
<row>
<entry>subject</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>e-mail subject.</entry>
</row>
<row>
<entry>newsgroups</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>newsgroups to post to.
Separate entries by a comma.</entry>
</row>
<row>
<entry>followupto</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>addresses to follow up to.
Separate entries by a comma.</entry>
</row>
<row>
<entry>extra</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>any extra information you
want passed to the link, such
as style sheet classes</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
mailto automates the creation of mailto links and optionally
encodes them. Encoding e-mails makes it more difficult for
web spiders to pick up e-mail addresses off of your site.
</para>
<note>
<title>Technical Note</title>
<para>
javascript is probably the most thorough form of
encoding, although you can use hex encoding too.
</para>
</note>
<example>
<title>mailto</title>
<programlisting>
{mailto address="me@domain.com"}
{mailto address="me@domain.com" text="send me some mail"}
{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"'}
<sect1 id="language.function.mailto">
<title>mailto</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
<colspec colname="type" align="center" />
<colspec colname="required" align="center" />
<colspec colname="default" align="center" />
<colspec colname="desc" />
<thead>
<row>
<entry>Attribute Name</entry>
<entry>Type</entry>
<entry>Required</entry>
<entry>Default</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>address</entry>
<entry>string</entry>
<entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the e-mail address</entry>
</row>
<row>
<entry>text</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the text to display, default is the e-mail address</entry>
</row>
<row>
<entry>encode</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>none</emphasis></entry>
<entry>How to encode the e-mail. Can be one of <literal>none</literal>,
<literal>hex</literal> or <literal>javascript</literal>.</entry>
</row>
<row>
<entry>cc</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>e-mail addresses to carbon copy. Separate entries by a comma.
</entry>
</row>
<row>
<entry>bcc</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>e-mail addresses to blind carbon copy.
Separate entries by a comma.</entry>
</row>
<row>
<entry>subject</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>e-mail subject.</entry>
</row>
<row>
<entry>newsgroups</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>newsgroups to post to. Separate entries by a comma.</entry>
</row>
<row>
<entry>followupto</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>addresses to follow up to. Separate entries by a comma.</entry>
</row>
<row>
<entry>extra</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>any extra information you want passed to the link, such
as style sheet classes</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
mailto automates the creation of mailto links and optionally
encodes them. Encoding e-mails makes it more difficult for
web spiders to pick up e-mail addresses off of your site.
</para>
<note>
<title>Technical Note</title>
<para>
javascript is probably the most thorough form of
encoding, although you can use hex encoding too.
</para>
</note>
<example>
<title>mailto</title>
<programlisting>
{mailto address="me@example.com"}
{mailto address="me@example.com" text="send me some mail"}
{mailto address="me@example.com" encode="javascript"}
{mailto address="me@example.com" encode="hex"}
{mailto address="me@example.com" subject="Hello to you!"}
{mailto address="me@example.com" cc="you@example.com,they@example.com"}
{mailto address="me@example.com" extra='class="email"'}
OUTPUT:
&lt;a href="mailto:me@domain.com" &gt;me@domain.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;me@example.com&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
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
%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:me@domain.com?subject=Hello%20to%20you%21" &gt;me@domain.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@domain.com" class="email"&gt;me@domain.com&lt;/a&gt;</programlisting>
&lt;a href="mailto:me@example.com?subject=Hello%20to%20you%21" &gt;me@example.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@example.com" class="email"&gt;me@example.com&lt;/a&gt;</programlisting>
</example>
</sect1>
<!-- Keep this comment at the end of the file

View File

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

View File

@@ -18,7 +18,7 @@
<title>displaying request variables</title>
<programlisting>
<![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}
{* 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
manageable way to separate application logic and content from its
presentation. This is best described in a situation where the application
programmer and the template designer play different roles, or in most cases
are not the same person. For example, let's say you are creating a web page
that is displaying a 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
programmer and the template designer play different roles, or in most
cases are not the same person.
</para>
<para>
For example, let's say you are creating a web page that is displaying a
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 tables, background colors, font sizes, style sheets, etc.) One day
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
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
desire NO logic in your templates you certainly can do so by boiling the
content down to text and variables only.
desire <emphasis>no</emphasis> logic in your templates you certainly can
do so by boiling the content down to text and variables only.
</para>
<para>
One of the unique aspects about Smarty is the template compiling. This means
Smarty reads the template files and creates PHP scripts from them. Once
they are created, they are executed from then on. Therefore there is no
costly template file parsing for each request, and each template can take
full advantage of PHP compiler cache solutions such as Zend Accelerator
(<ulink url="&url.zend;">&url.zend;</ulink>) or PHP Accelerator
One of the unique aspects about Smarty is the template compiling. This
means Smarty reads the template files and creates PHP scripts from them.
Once they are created, they are executed from then on. Therefore there is
no costly template file parsing for each request, and each template can
take full advantage of PHP compiler cache solutions such as Zend
Accelerator (<ulink url="&url.zend;">&url.zend;</ulink>) or PHP Accelerator
(<ulink url="&url.php-accelerator;">&url.php-accelerator;</ulink>).
</para>
<para>
@@ -73,8 +76,10 @@
</listitem>
<listitem>
<para>
You can make <link linkend="language.custom.functions">custom functions</link>
and custom <link linkend="language.modifiers">variable modifiers</link>, so the
You can make <link
linkend="language.custom.functions">custom functions</link>
and custom <link
linkend="language.modifiers">variable modifiers</link>, so the
template language is extremely extensible.
</para>
</listitem>
@@ -87,8 +92,8 @@
<listitem>
<para>
The if/elseif/else/endif constructs are passed to the
PHP parser, so the {if ...} expression syntax can be as simple or as complex
as you like.
PHP parser, so the {if ...} expression syntax can be as simple or as
complex as you like.
</para>
</listitem>
<listitem>
@@ -98,9 +103,9 @@
</listitem>
<listitem>
<para>
It is possible to embed PHP code right in your template files,
although this may not be needed (nor recommended)
since the engine is so customizable.
It is possible to embed PHP code right in your template files, although
this may not be needed (nor recommended) since the engine is so
customizable.
</para>
</listitem>
<listitem>
@@ -160,9 +165,9 @@ debug.tpl
Smarty uses a PHP constant named <link
linkend="constant.smarty.dir">SMARTY_DIR</link> which is the system
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
<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
define SMARTY_DIR manually. SMARTY_DIR <emphasis>must</emphasis> include a
trailing slash.
@@ -185,7 +190,7 @@ $smarty = new Smarty;
<para>
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:
</para>
@@ -232,18 +237,20 @@ $smarty = new Smarty;
<para>
Now that the library files are in place, it's time to setup the Smarty
directories for your application. Smarty requires four directories which
are (by default) named <emphasis>templates</emphasis>,
<emphasis>templates_c</emphasis>, <emphasis>configs</emphasis> and
<emphasis>cache</emphasis>. Each of these are definable by the Smarty class
properties <emphasis>$template_dir</emphasis>,
<emphasis>$compile_dir</emphasis>, <emphasis>$config_dir</emphasis>, and
<emphasis>$cache_dir</emphasis> respectively. It is highly recommended
are (by default) named <filename class="directory">templates</filename>,
<filename class="directory">templates_c</filename>, <filename
class="directory">configs</filename> and <filename
class="directory">cache</filename>. Each of these are definable by the
Smarty class properties <varname>$template_dir</varname>,
<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 will use Smarty.
</para>
<para>
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
directly by the web browser. Therefore to avoid any security concerns, it
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
application, just replace "guestbook" with the name of your app. We'll
place our Smarty directories under
"/web/www.mydomain.com/smarty/guestbook/".
<filename
class="directory">/web/www.example.com/smarty/guestbook/</filename>.
</para>
<para>
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",
and place it in a subdirectory under the document root called
"/guestbook/".
script accessed by the web browser. We will call our script
<filename>index.php</filename>, and place it in a subdirectory under the
document root called <filename class="directory">/guestbook/</filename>.
</para>
<note>
@@ -269,7 +277,7 @@ $smarty = new Smarty;
<para>
It is convenient to setup the web server so that "index.php" can be
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
"index.php" onto the end of your DirectoryIndex setting (separate each
entry with a space.)
@@ -291,12 +299,12 @@ $smarty = new Smarty;
/usr/local/lib/php/Smarty/internals/*.php
/usr/local/lib/php/Smarty/plugins/*.php
/web/www.mydomain.com/smarty/guestbook/templates/
/web/www.mydomain.com/smarty/guestbook/templates_c/
/web/www.mydomain.com/smarty/guestbook/configs/
/web/www.mydomain.com/smarty/guestbook/cache/
/web/www.example.com/smarty/guestbook/templates/
/web/www.example.com/smarty/guestbook/templates_c/
/web/www.example.com/smarty/guestbook/configs/
/web/www.example.com/smarty/guestbook/cache/
/web/www.mydomain.com/docs/guestbook/index.php
/web/www.example.com/docs/guestbook/index.php
]]>
</screen>
</example>
@@ -314,11 +322,11 @@ $smarty = new Smarty;
<title>Setting file permissions</title>
<programlisting role="shell">
<![CDATA[
chown nobody:nobody /web/www.mydomain.com/smarty/guestbook/templates_c/
chmod 770 /web/www.mydomain.com/smarty/guestbook/templates_c/
chown nobody:nobody /web/www.example.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/
chmod 770 /web/www.mydomain.com/smarty/guestbook/cache/
chown nobody:nobody /web/www.example.com/smarty/guestbook/cache/
chmod 770 /web/www.example.com/smarty/guestbook/cache/
]]>
</programlisting>
</example>
@@ -339,7 +347,7 @@ chmod 770 /web/www.mydomain.com/smarty/guestbook/cache/
</para>
<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>
<![CDATA[
@@ -369,7 +377,7 @@ Hello, {$name}!
</para>
<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">
<![CDATA[
<?php
@@ -379,10 +387,10 @@ require('Smarty.class.php');
$smarty = new Smarty;
$smarty->template_dir = '/web/www.mydomain.com/smarty/guestbook/templates/';
$smarty->compile_dir = '/web/www.mydomain.com/smarty/guestbook/templates_c/';
$smarty->config_dir = '/web/www.mydomain.com/smarty/guestbook/configs/';
$smarty->cache_dir = '/web/www.mydomain.com/smarty/guestbook/cache/';
$smarty->template_dir = '/web/www.example.com/smarty/guestbook/templates/';
$smarty->compile_dir = '/web/www.example.com/smarty/guestbook/templates_c/';
$smarty->config_dir = '/web/www.example.com/smarty/guestbook/configs/';
$smarty->cache_dir = '/web/www.example.com/smarty/guestbook/cache/';
$smarty->assign('name','Ned');
@@ -396,17 +404,18 @@ $smarty->display('index.tpl');
<title>Technical Note</title>
<para>
In our example, we are setting absolute paths to all of the Smarty
directories. If '/web/www.mydomain.com/smarty/guestbook/' is within your
PHP include_path, then these settings are not necessary. However, it is
more efficient and (from experience) less error-prone to set them to
absolute paths. This ensures that Smarty is getting files from the
directories you intended.
directories. If <filename
class="directory">/web/www.example.com/smarty/guestbook/</filename> is
within your PHP include_path, then these settings are not necessary.
However, it is more efficient and (from experience) less error-prone to
set them to absolute paths. This ensures that Smarty is getting files
from the directories you intended.
</para>
</note>
<para>
Now load the index.php file from your web browser. You should see "Hello,
Ned!"
Now load the <filename>index.php</filename> file from your web browser.
You should see "Hello, Ned!"
</para>
<para>
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
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
called "setup.php". In our example environment, "/php/includes" is in our
include_path. Be sure you set this up too, or use absolute file paths.
called <filename>setup.php</filename>. In our example environment,
"/php/includes" is in our include_path. Be sure you set this up too, or
use absolute file paths.
</para>
<example>
@@ -448,17 +458,18 @@ class Smarty_GuestBook extends Smarty {
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->template_dir = '/web/www.mydomain.com/smarty/guestbook/templates/';
$this->compile_dir = '/web/www.mydomain.com/smarty/guestbook/templates_c/';
$this->config_dir = '/web/www.mydomain.com/smarty/guestbook/configs/';
$this->cache_dir = '/web/www.mydomain.com/smarty/guestbook/cache/';
$this->template_dir = '/web/www.example.com/smarty/guestbook/templates/';
$this->compile_dir = '/web/www.example.com/smarty/guestbook/templates_c/';
$this->config_dir = '/web/www.example.com/smarty/guestbook/configs/';
$this->cache_dir = '/web/www.example.com/smarty/guestbook/cache/';
$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>
<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">
<![CDATA[
<?php
@@ -491,7 +502,8 @@ $smarty->display('index.tpl');
<para>
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>
</sect1>

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="advanced.features.objects">
<title>Objects</title>
<para>
Smarty allows access to PHP objects through the templates. There are
<sect1 id="advanced.features.objects">
<title>Objects</title>
<para>
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,
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
@@ -13,41 +13,41 @@
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
keep template syntax to a minimum.
</para>
</para>
<para>
If security is enabled, no private methods or functions can be accessed
(begininning with "_"). If a method and property of the same name exist,
the method will be used.
If security is enabled, no private methods or functions can be accessed
(begininning with "_"). If a method and property of the same name exist,
the method will be used.
</para>
<para>
You can restrict the methods and properties that can be accessed by
listing them in an array as the third registration parameter.
You can restrict the methods and properties that can be accessed by
listing them in an array as the third registration parameter.
</para>
<para>
By default, parameters passed to objects through the templates are 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
the parameters passed one at a time for each argument like traditional
object parameter passing, set the fourth registration parameter to false.
By default, parameters passed to objects through the templates are 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
the parameters passed one at a time for each argument like traditional
object parameter passing, set the fourth registration parameter to false.
</para>
<para>
The optional fifth parameter has only effect with
<parameter>format</parameter> being <literal>true</literal>
and contains a list ob methods that should be treated as
blocks. That means these methods have a closing tag in the
template
(<literal>{foobar->meth2}...{/foobar->meth2}</literal>) and
the parameters to the methods have the same synopsis as the
parameters for block-function-plugins: They get 4 parameters
<parameter>$params</parameter>,
<parameter>$content</parameter>,
<parameter>&amp;$smarty</parameter> and
<parameter>&amp;$repeat</parameter> and they also behave like
block-function-plugins.
The optional fifth parameter has only effect with
<parameter>format</parameter> being <literal>true</literal>
and contains a list ob methods that should be treated as
blocks. That means these methods have a closing tag in the
template
(<literal>{foobar->meth2}...{/foobar->meth2}</literal>) and
the parameters to the methods have the same synopsis as the
parameters for block-function-plugins: They get 4 parameters
<parameter>$params</parameter>,
<parameter>$content</parameter>,
<parameter>&amp;$smarty</parameter> and
<parameter>&amp;$repeat</parameter> and they also behave like
block-function-plugins.
</para>
<example>
<title>using a registered or assigned object</title>
<programlisting role="php">
<example>
<title>using a registered or assigned object</title>
<programlisting role="php">
<![CDATA[
<?php
// the object
@@ -71,9 +71,13 @@ $smarty->assign_by_ref("myobj", $myobj);
$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 *}
{foobar->meth1 p1="foo" p2=$bar}
@@ -84,8 +88,8 @@ the output was {$output}
{* access our assigned object *}
{$myobj->meth1("foo",$bar)}
]]>
</programlisting>
</example>
</programlisting>
</example>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:

View File

@@ -42,7 +42,7 @@ $smarty->display("index.tpl");
// a simple protection against spambots
?>
]]>
</programlisting>
</programlisting>
</example>
</sect1>
<!-- Keep this comment at the end of the file

View File

@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="advanced.features.postfilters">
<title>Postfilters</title>
<para>
Template postfilters are PHP functions that your templates are ran through
after they are compiled. Postfilters can be either
<link linkend="api.register.postfilter">registered</link> or loaded
from the plugins directory by using
<link linkend="api.load.filter">load_filter()</link> function or by
setting
<link linkend="variable.autoload.filters">$autoload_filters</link>
variable. Smarty will pass the compiled template code as the first
argument, and expect the function to return the result of the
processing.
</para>
<example>
<title>using a template postfilter</title>
<programlisting role="php">
<sect1 id="advanced.features.postfilters">
<title>Postfilters</title>
<para>
Template postfilters are PHP functions that your templates are ran through
after they are compiled. Postfilters can be either
<link linkend="api.register.postfilter">registered</link> or loaded
from the plugins directory by using
<link linkend="api.load.filter">load_filter()</link> function or by
setting
<link linkend="variable.autoload.filters">$autoload_filters</link>
variable. Smarty will pass the compiled template code as the first
argument, and expect the function to return the result of the
processing.
</para>
<example>
<title>using a template postfilter</title>
<programlisting role="php">
<![CDATA[
<?php
// put this in your application
@@ -29,13 +29,18 @@ function add_header_comment($tpl_source, &$smarty)
$smarty->register_postfilter("add_header_comment");
$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! -->
{* rest of template content... *}
]]>
</programlisting>
</example>
</screen>
</example>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:

View File

@@ -1,23 +1,28 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="advanced.features.prefilters">
<title>Prefilters</title>
<para>
Template prefilters are PHP functions that your templates are ran through
before they are compiled. This is good for preprocessing your templates
to remove unwanted comments, keeping an eye on what people are putting
in their templates, etc. Prefilters can be either
<link linkend="api.register.prefilter">registered</link> or loaded from
the plugins directory by using
<link linkend="api.load.filter">load_filter()</link> function or by
setting
<link linkend="variable.autoload.filters">$autoload_filters</link> variable.
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">
<sect1 id="advanced.features.prefilters">
<title>Prefilters</title>
<para>
Template prefilters are PHP functions that your templates are ran through
before they are compiled. This is good for preprocessing your templates
to remove unwanted comments, keeping an eye on what people are putting
in their templates, etc.
</para>
<para>
Prefilters can be either <link
linkend="api.register.prefilter">registered</link> or loaded from
the plugins directory by using <link
linkend="api.load.filter">load_filter()</link> function or by setting
the <link linkend="variable.autoload.filters">$autoload_filters</link>
variable.
</para>
<para>
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[
<?php
// put this in your application
@@ -30,12 +35,12 @@ function remove_dw_comments($tpl_source, &$smarty)
$smarty->register_prefilter("remove_dw_comments");
$smarty->display("index.tpl");
?>
{* Smarty template index.tpl *}
<!--# this line will get removed by the prefilter -->
]]>
</programlisting>
</example>
</programlisting>
<para>
This will remove all the comments in the template source.
</para>
</example>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:

View File

@@ -3,12 +3,12 @@
<sect1 id="template.resources">
<title>Resources</title>
<para>
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,
you supply a resource type, followed by the appropriate path and template
name. If a resource is not explicitly given the value of <link
linkend="variable.default.resource.type">$default_resource_type</link> is
assumed.
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,
you supply a resource type, followed by the appropriate path and template
name. If a resource is not explicitly given the value of <link
linkend="variable.default.resource.type">$default_resource_type</link> is
assumed.
</para>
<sect2 id="templates.from.template.dir">
<title>Templates from $template_dir</title>