mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
cleaning words spacing, killing tabulations, using roles for programlisting..
This commit is contained in:
@@ -10,17 +10,18 @@
|
|||||||
or malformed variable names. If this happens, you will see an error
|
or malformed variable names. If this happens, you will see an error
|
||||||
similar to the following:
|
similar to the following:
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Smarty errors</title>
|
<title>Smarty errors</title>
|
||||||
<programlisting>
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
Warning: Smarty: [in index.tpl line 4]: syntax error: unknown tag - '%blah'
|
Warning: Smarty: [in index.tpl line 4]: syntax error: unknown tag - '%blah'
|
||||||
in /path/to/smarty/Smarty.class.php on line 1041
|
in /path/to/smarty/Smarty.class.php on line 1041
|
||||||
|
|
||||||
Fatal error: Smarty: [in index.tpl line 28]: syntax error: missing section name
|
Fatal error: Smarty: [in index.tpl line 28]: syntax error: missing section name
|
||||||
in /path/to/smarty/Smarty.class.php on line 1041</programlisting>
|
in /path/to/smarty/Smarty.class.php on line 1041
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Smarty shows you the template name, the line number and the error.
|
Smarty shows you the template name, the line number and the error.
|
||||||
After that, the error consists of the actual line number in the Smarty
|
After that, the error consists of the actual line number in the Smarty
|
||||||
@@ -35,8 +36,11 @@ Fatal error: Smarty: [in index.tpl line 28]: syntax error: missing section name
|
|||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>PHP parsing errors</title>
|
<title>PHP parsing errors</title>
|
||||||
<programlisting>
|
<screen>
|
||||||
Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75</programlisting>
|
<![CDATA[
|
||||||
|
Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@@ -67,7 +71,7 @@ Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75
|
|||||||
<example>
|
<example>
|
||||||
<title>Printing &nbsp; when a variable is empty</title>
|
<title>Printing &nbsp; when a variable is empty</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{* the long way *}
|
{* the long way *}
|
||||||
|
|
||||||
{if $title eq ""}
|
{if $title eq ""}
|
||||||
@@ -79,7 +83,9 @@ Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75
|
|||||||
|
|
||||||
{* the short way *}
|
{* the short way *}
|
||||||
|
|
||||||
{$title|default:"&nbsp;"}</programlisting>
|
{$title|default:"&nbsp;"}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
@@ -94,11 +100,14 @@ Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75
|
|||||||
<example>
|
<example>
|
||||||
<title>Assigning a template variable its default value</title>
|
<title>Assigning a template variable its default value</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{* do this somewhere at the top of your template *}
|
{* do this somewhere at the top of your template *}
|
||||||
{assign var="title" value=$title|default:"no title"}
|
{assign var="title" value=$title|default:"no title"}
|
||||||
|
|
||||||
{* if $title was empty, it now contains the value "no title" when you print it *}
|
{* if $title was empty, it now contains the value "no title" when you print it *}
|
||||||
{$title}</programlisting>
|
{$title}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="tips.passing.vars">
|
<sect1 id="tips.passing.vars">
|
||||||
@@ -113,7 +122,7 @@ Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75
|
|||||||
<example>
|
<example>
|
||||||
<title>Passing the title variable to the header template</title>
|
<title>Passing the title variable to the header template</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
mainpage.tpl
|
mainpage.tpl
|
||||||
------------
|
------------
|
||||||
|
|
||||||
@@ -143,7 +152,9 @@ header.tpl
|
|||||||
footer.tpl
|
footer.tpl
|
||||||
----------
|
----------
|
||||||
</BODY>
|
</BODY>
|
||||||
</HTML></programlisting>
|
</HTML>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
When the main page is drawn, the title of "Main Page" is passed to the
|
When the main page is drawn, the title of "Main Page" is passed to the
|
||||||
@@ -171,6 +182,7 @@ footer.tpl
|
|||||||
<example>
|
<example>
|
||||||
<title>using date_format</title>
|
<title>using date_format</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{$startDate|date_format}
|
{$startDate|date_format}
|
||||||
|
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
@@ -187,7 +199,9 @@ OUTPUT:
|
|||||||
|
|
||||||
{if $date1 < $date2}
|
{if $date1 < $date2}
|
||||||
...
|
...
|
||||||
{/if}</programlisting>
|
{/if}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
When using {html_select_date} in a template, The programmer will most
|
When using {html_select_date} in a template, The programmer will most
|
||||||
@@ -196,7 +210,8 @@ OUTPUT:
|
|||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>converting form date elements back to a timestamp</title>
|
<title>converting form date elements back to a timestamp</title>
|
||||||
<programlisting>
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
// this assumes your form elements are named
|
// this assumes your form elements are named
|
||||||
// startDate_Day, startDate_Month, startDate_Year
|
// startDate_Day, startDate_Month, startDate_Year
|
||||||
|
|
||||||
@@ -212,7 +227,9 @@ function makeTimeStamp($year="",$month="",$day="")
|
|||||||
$day = strftime("%d");
|
$day = strftime("%d");
|
||||||
|
|
||||||
return mktime(0,0,0,$month,$day,$year);
|
return mktime(0,0,0,$month,$day,$year);
|
||||||
}</programlisting>
|
}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="tips.wap">
|
<sect1 id="tips.wap">
|
||||||
@@ -227,7 +244,10 @@ function makeTimeStamp($year="",$month="",$day="")
|
|||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>using insert to write a WML Content-Type header</title>
|
<title>using insert to write a WML Content-Type header</title>
|
||||||
<programlisting>
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
// be sure apache is configure for the .wml extensions!
|
// be sure apache is configure for the .wml extensions!
|
||||||
// put this function somewhere in your application, or in Smarty.addons.php
|
// put this function somewhere in your application, or in Smarty.addons.php
|
||||||
function insert_header($params) {
|
function insert_header($params) {
|
||||||
@@ -238,8 +258,14 @@ function insert_header($params) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// your Smarty template _must_ begin with the insert tag example:
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
your Smarty template <emphasis>must</emphasis> begin with the insert tag :
|
||||||
|
</para>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
{insert name=header content="Content-Type: text/vnd.wap.wml"}
|
{insert name=header content="Content-Type: text/vnd.wap.wml"}
|
||||||
|
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
@@ -263,7 +289,9 @@ Press OK to continue...
|
|||||||
Pretty easy isn't it?
|
Pretty easy isn't it?
|
||||||
</p>
|
</p>
|
||||||
</card>
|
</card>
|
||||||
</wml></programlisting>
|
</wml>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="tips.componentized.templates">
|
<sect1 id="tips.componentized.templates">
|
||||||
@@ -285,11 +313,11 @@ Pretty easy isn't it?
|
|||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>componentized template</title>
|
<title>componentized template</title>
|
||||||
<programlisting>
|
<programlisting role="php">
|
||||||
function.load_ticker.php
|
<![CDATA[
|
||||||
---------------
|
<?php
|
||||||
|
|
||||||
<?php
|
// function.load_ticker.php
|
||||||
function smarty_function_load_ticker($params, &$smarty) {
|
function smarty_function_load_ticker($params, &$smarty) {
|
||||||
// setup our function for fetching stock data
|
// setup our function for fetching stock data
|
||||||
function fetch_ticker($params['symbol']) {
|
function fetch_ticker($params['symbol']) {
|
||||||
@@ -304,8 +332,11 @@ function smarty_function_load_ticker($params, &$smarty) {
|
|||||||
// assign template variable
|
// assign template variable
|
||||||
$smarty->assign($params['assign'],$ticker_info);
|
$smarty->assign($params['assign'],$ticker_info);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
index.tpl
|
index.tpl
|
||||||
---------
|
---------
|
||||||
|
|
||||||
@@ -313,7 +344,9 @@ index.tpl
|
|||||||
|
|
||||||
{load_ticker symbol="YHOO" assign="ticker"}
|
{load_ticker symbol="YHOO" assign="ticker"}
|
||||||
|
|
||||||
Stock Name: {$ticker.name} Stock Price: {$ticker.price}</programlisting>
|
Stock Name: {$ticker.name} Stock Price: {$ticker.price}
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="tips.obfuscating.email">
|
<sect1 id="tips.obfuscating.email">
|
||||||
@@ -328,13 +361,13 @@ Stock Name: {$ticker.name} Stock Price: {$ticker.price}</programlisting>
|
|||||||
<example>
|
<example>
|
||||||
<title>Example of Obfuscating an E-mail Address</title>
|
<title>Example of Obfuscating an E-mail Address</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
index.tpl
|
index.tpl
|
||||||
---------
|
---------
|
||||||
|
|
||||||
Send inquiries to
|
Send inquiries to
|
||||||
{mailto address=$EmailAddress encode="javascript" subject="Hello"}
|
{mailto address=$EmailAddress encode="javascript" subject="Hello"}
|
||||||
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<note>
|
<note>
|
||||||
|
@@ -49,28 +49,78 @@
|
|||||||
Some of Smarty's features:
|
Some of Smarty's features:
|
||||||
</para>
|
</para>
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
<listitem><para>It is extremely fast.</para></listitem>
|
<listitem>
|
||||||
<listitem><para>It is efficient since the PHP parser does the
|
<para>
|
||||||
dirty work.</para></listitem>
|
It is extremely fast.
|
||||||
<listitem><para>No template parsing overhead, only compiles once.</para></listitem>
|
</para>
|
||||||
<listitem><para>It is smart about recompiling only the template
|
</listitem>
|
||||||
files that have changed.</para></listitem>
|
<listitem>
|
||||||
<listitem><para>You can make <link linkend="language.custom.functions">custom
|
<para>
|
||||||
functions</link> and custom <link linkend="language.modifiers">variable
|
It is efficient since the PHP parser does the dirty work.
|
||||||
modifiers</link>, so the template language is extremely extensible.</para></listitem>
|
</para>
|
||||||
<listitem><para>Configurable template delimiter tag syntax, so you can use
|
</listitem>
|
||||||
{}, {{}}, <!--{}-->, etc.</para></listitem>
|
<listitem>
|
||||||
<listitem><para>The if/elseif/else/endif constructs are passed to the
|
<para>
|
||||||
|
No template parsing overhead, only compiles once.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
It is smart about recompiling only the template files that have changed.
|
||||||
|
</para>
|
||||||
|
</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
|
||||||
|
template language is extremely extensible.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Configurable template delimiter tag syntax, so you can use
|
||||||
|
{}, {{}}, <!--{}-->, etc.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
<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
|
PHP parser, so the {if ...} expression syntax can be as simple or as complex
|
||||||
as you like.</para></listitem>
|
as you like.
|
||||||
<listitem><para>Unlimited nesting of sections, ifs, etc. allowed.</para></listitem>
|
</para>
|
||||||
<listitem><para>It is possible to embed PHP code right in your template files,
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Unlimited nesting of sections, ifs, etc. allowed.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
It is possible to embed PHP code right in your template files,
|
||||||
although this may not be needed (nor recommended)
|
although this may not be needed (nor recommended)
|
||||||
since the engine is so customizable.</para></listitem>
|
since the engine is so customizable.
|
||||||
<listitem><para>Built-in caching support</para></listitem>
|
</para>
|
||||||
<listitem><para>Arbitrary template sources</para></listitem>
|
</listitem>
|
||||||
<listitem><para>Custom cache handling functions</para></listitem>
|
<listitem>
|
||||||
<listitem><para>Plugin architecture</para></listitem>
|
<para>
|
||||||
|
Built-in caching support
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Arbitrary template sources
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Custom cache handling functions
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Plugin architecture
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</chapter>
|
</chapter>
|
||||||
<chapter id="installation">
|
<chapter id="installation">
|
||||||
@@ -94,14 +144,16 @@
|
|||||||
<example>
|
<example>
|
||||||
<title>Smarty library files</title>
|
<title>Smarty library files</title>
|
||||||
<screen>
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
Smarty.class.php
|
Smarty.class.php
|
||||||
Smarty_Compiler.class.php
|
Smarty_Compiler.class.php
|
||||||
Config_File.class.php
|
Config_File.class.php
|
||||||
debug.tpl
|
debug.tpl
|
||||||
/core/*.php (all of them)
|
/core/*.php (all of them)
|
||||||
/plugins/*.php (all of them)</screen>
|
/plugins/*.php (all of them)
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
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
|
||||||
@@ -119,9 +171,14 @@ debug.tpl
|
|||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Create Smarty instance of Smarty</title>
|
<title>Create Smarty instance of Smarty</title>
|
||||||
<screen>
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
require('Smarty.class.php');
|
require('Smarty.class.php');
|
||||||
$smarty = new Smarty;</screen>
|
$smarty = new Smarty;
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@@ -132,27 +189,42 @@ $smarty = new Smarty;</screen>
|
|||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Supply absolute path to library file</title>
|
<title>Supply absolute path to library file</title>
|
||||||
<screen>
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
require('/usr/local/lib/php/Smarty/Smarty.class.php');
|
require('/usr/local/lib/php/Smarty/Smarty.class.php');
|
||||||
$smarty = new Smarty;</screen>
|
$smarty = new Smarty;
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Add library directory to php_include path</title>
|
<title>Add library directory to php_include path</title>
|
||||||
<screen>
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
// Edit your php.ini file, add the Smarty library
|
// Edit your php.ini file, add the Smarty library
|
||||||
// directory to the include_path and restart web server.
|
// directory to the include_path and restart web server.
|
||||||
// Then the following should work:
|
// Then the following should work:
|
||||||
require('Smarty.class.php');
|
require('Smarty.class.php');
|
||||||
$smarty = new Smarty;</screen>
|
$smarty = new Smarty;
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Set SMARTY_DIR constant manually</title>
|
<title>Set SMARTY_DIR constant manually</title>
|
||||||
<screen>
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
define('SMARTY_DIR', '/usr/local/lib/php/Smarty/');
|
define('SMARTY_DIR', '/usr/local/lib/php/Smarty/');
|
||||||
require(SMARTY_DIR . 'Smarty.class.php');
|
require(SMARTY_DIR . 'Smarty.class.php');
|
||||||
$smarty = new Smarty;</screen>
|
$smarty = new Smarty;
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@@ -209,6 +281,7 @@ $smarty = new Smarty;</screen>
|
|||||||
<example>
|
<example>
|
||||||
<title>Example file structure</title>
|
<title>Example file structure</title>
|
||||||
<screen>
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
/usr/local/lib/php/Smarty/Smarty.class.php
|
/usr/local/lib/php/Smarty/Smarty.class.php
|
||||||
/usr/local/lib/php/Smarty/Smarty_Compiler.class.php
|
/usr/local/lib/php/Smarty/Smarty_Compiler.class.php
|
||||||
/usr/local/lib/php/Smarty/Config_File.class.php
|
/usr/local/lib/php/Smarty/Config_File.class.php
|
||||||
@@ -221,7 +294,9 @@ $smarty = new Smarty;</screen>
|
|||||||
/web/www.mydomain.com/smarty/guestbook/configs/
|
/web/www.mydomain.com/smarty/guestbook/configs/
|
||||||
/web/www.mydomain.com/smarty/guestbook/cache/
|
/web/www.mydomain.com/smarty/guestbook/cache/
|
||||||
|
|
||||||
/web/www.mydomain.com/docs/guestbook/index.php</screen>
|
/web/www.mydomain.com/docs/guestbook/index.php
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@@ -235,13 +310,15 @@ $smarty = new Smarty;</screen>
|
|||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Setting file permissions</title>
|
<title>Setting file permissions</title>
|
||||||
<screen>
|
<programlisting role="shell">
|
||||||
|
<![CDATA[
|
||||||
chown nobody:nobody /web/www.mydomain.com/smarty/guestbook/templates_c/
|
chown nobody:nobody /web/www.mydomain.com/smarty/guestbook/templates_c/
|
||||||
chmod 770 /web/www.mydomain.com/smarty/guestbook/templates_c/
|
chmod 770 /web/www.mydomain.com/smarty/guestbook/templates_c/
|
||||||
|
|
||||||
chown nobody:nobody /web/www.mydomain.com/smarty/guestbook/cache/
|
chown nobody:nobody /web/www.mydomain.com/smarty/guestbook/cache/
|
||||||
chmod 770 /web/www.mydomain.com/smarty/guestbook/cache/</screen>
|
chmod 770 /web/www.mydomain.com/smarty/guestbook/cache/
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
@@ -262,13 +339,15 @@ chmod 770 /web/www.mydomain.com/smarty/guestbook/cache/</screen>
|
|||||||
<example>
|
<example>
|
||||||
<title>Editing /web/www.mydomain.com/smarty/guestbook/templates/index.tpl</title>
|
<title>Editing /web/www.mydomain.com/smarty/guestbook/templates/index.tpl</title>
|
||||||
<screen>
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
{* Smarty *}
|
{* Smarty *}
|
||||||
|
|
||||||
Hello, {$name}!</screen>
|
Hello, {$name}!
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -289,7 +368,10 @@ Hello, {$name}!</screen>
|
|||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Editing /web/www.mydomain.com/docs/guestbook/index.php</title>
|
<title>Editing /web/www.mydomain.com/docs/guestbook/index.php</title>
|
||||||
<screen>
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
// load Smarty library
|
// load Smarty library
|
||||||
require('Smarty.class.php');
|
require('Smarty.class.php');
|
||||||
|
|
||||||
@@ -302,7 +384,10 @@ $smarty->cache_dir = '/web/www.mydomain.com/smarty/guestbook/cache/';
|
|||||||
|
|
||||||
$smarty->assign('name','Ned');
|
$smarty->assign('name','Ned');
|
||||||
|
|
||||||
$smarty->display('index.tpl');</screen>
|
$smarty->display('index.tpl');
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
@@ -344,7 +429,9 @@ $smarty->display('index.tpl');</screen>
|
|||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Editing /php/includes/guestbook/setup.php</title>
|
<title>Editing /php/includes/guestbook/setup.php</title>
|
||||||
<screen>
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
// load Smarty library
|
// load Smarty library
|
||||||
require('Smarty.class.php');
|
require('Smarty.class.php');
|
||||||
@@ -371,7 +458,10 @@ class Smarty_GuestBook extends Smarty {
|
|||||||
$this->assign('app_name','Guest Book');
|
$this->assign('app_name','Guest Book');
|
||||||
}
|
}
|
||||||
|
|
||||||
}</screen>
|
}
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
@@ -380,7 +470,9 @@ class Smarty_GuestBook extends Smarty {
|
|||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>Editing /web/www.mydomain.com/docs/guestbook/index.php</title>
|
<title>Editing /web/www.mydomain.com/docs/guestbook/index.php</title>
|
||||||
<screen>
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
require('guestbook/setup.php');
|
require('guestbook/setup.php');
|
||||||
|
|
||||||
@@ -388,7 +480,10 @@ $smarty = new Smarty_GuestBook;
|
|||||||
|
|
||||||
$smarty->assign('name','Ned');
|
$smarty->assign('name','Ned');
|
||||||
|
|
||||||
$smarty->display('index.tpl');</screen>
|
$smarty->display('index.tpl');
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
Reference in New Issue
Block a user