mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 02:14:26 +02:00
added RESOURCES file
This commit is contained in:
12
RESOURCES
Normal file
12
RESOURCES
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
Smarty Resources on the Web:
|
||||||
|
|
||||||
|
Home Page:
|
||||||
|
http://www.phpinsider.com/php/code/Smarty
|
||||||
|
|
||||||
|
Tutorials:
|
||||||
|
http://www.zend.com/zend/tut/tutsweatpart1.php
|
||||||
|
|
||||||
|
Misc:
|
||||||
|
http://freshmeat.net/projects/smarty/
|
||||||
|
http://www.hotscripts.com/Detailed/8817.html
|
||||||
|
|
73
docs.sgml
73
docs.sgml
@@ -144,7 +144,7 @@
|
|||||||
linkend="setting.cache.lifetime">expires</link>, regenerating a new
|
linkend="setting.cache.lifetime">expires</link>, regenerating a new
|
||||||
one. The default cache expire time can be configured from the
|
one. The default cache expire time can be configured from the
|
||||||
class. The exception to the rule is the <link
|
class. The exception to the rule is the <link
|
||||||
linkend="builtin.function.insert">insert</link> tag. Anything
|
linkend="builtin.functions.insert">insert</link> tag. Anything
|
||||||
generated by the insert tag is not cached, but run dynamically on
|
generated by the insert tag is not cached, but run dynamically on
|
||||||
every invocation, even within cached content.
|
every invocation, even within cached content.
|
||||||
</para>
|
</para>
|
||||||
@@ -472,7 +472,7 @@ require_once(SMARTY_DIR."Smarty.class.php");
|
|||||||
<title>$insert_tag_check</title>
|
<title>$insert_tag_check</title>
|
||||||
<para>
|
<para>
|
||||||
If you have $caching enabled and you do not use the <link
|
If you have $caching enabled and you do not use the <link
|
||||||
linkend="builtin.function.insert">insert</link> tag anywhere in
|
linkend="builtin.functions.insert">insert</link> tag anywhere in
|
||||||
your templates, set this to false. This saves the insert tag
|
your templates, set this to false. This saves the insert tag
|
||||||
search, speeding up cached page fetches.
|
search, speeding up cached page fetches.
|
||||||
</para>
|
</para>
|
||||||
@@ -503,7 +503,7 @@ require_once(SMARTY_DIR."Smarty.class.php");
|
|||||||
This tells Smarty how to handle PHP code embedded in the
|
This tells Smarty how to handle PHP code embedded in the
|
||||||
tempalates. There are four possible settings, default being
|
tempalates. There are four possible settings, default being
|
||||||
SMARTY_PHP_PASSTHRU. Note that this does NOT affect php code
|
SMARTY_PHP_PASSTHRU. Note that this does NOT affect php code
|
||||||
within <link linkend="builtin.function.php">{php}{/php}</link>
|
within <link linkend="builtin.functions.php">{php}{/php}</link>
|
||||||
tags in the template.
|
tags in the template.
|
||||||
</para>
|
</para>
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
@@ -2101,7 +2101,7 @@ pass=foobar
|
|||||||
are integral to the template language. You cannot create custom
|
are integral to the template language. You cannot create custom
|
||||||
functions with the same names, nor can you modify built-in functions.
|
functions with the same names, nor can you modify built-in functions.
|
||||||
</para>
|
</para>
|
||||||
<sect2 id="builtin.function.capture">
|
<sect2 id="builtin.functions.capture">
|
||||||
<title>capture</title>
|
<title>capture</title>
|
||||||
<para>
|
<para>
|
||||||
capture is used to collect the output of the template into a
|
capture is used to collect the output of the template into a
|
||||||
@@ -2266,7 +2266,7 @@ pass=foobar
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="builtin.function.include">
|
<sect2 id="builtin.functions.include">
|
||||||
<title>include</title>
|
<title>include</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=3>
|
<tgroup cols=3>
|
||||||
@@ -2317,9 +2317,10 @@ pass=foobar
|
|||||||
the attribute "file", which contains the template resource path.
|
the attribute "file", which contains the template resource path.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
You an optionally pass the assign attribute, which will specify a
|
You an optionally pass the <emphasis>assign</emphasis> attribute,
|
||||||
template variable name that the output of include will be assigned
|
which will specify a template variable name that the output of
|
||||||
to instead of displayed. This was added to Smarty 1.5.0.
|
<emphasis>include</emphasis> will be assigned to instead of
|
||||||
|
displayed. This was added to Smarty 1.5.0.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>function include</title>
|
<title>function include</title>
|
||||||
@@ -2352,7 +2353,7 @@ pass=foobar
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="builtin.function.include.php">
|
<sect2 id="builtin.functions.include.php">
|
||||||
<title>include_php</title>
|
<title>include_php</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=3>
|
<tgroup cols=3>
|
||||||
@@ -2407,9 +2408,10 @@ pass=foobar
|
|||||||
before hand.
|
before hand.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
You an optionally pass the assign attribute, which will specify a
|
You an optionally pass the <emphasis>assign</emphasis> attribute,
|
||||||
template variable name that the output of include_php will be
|
which will specify a template variable name that the output of
|
||||||
assigned to instead of displayed.
|
<emphasis>include</emphasis> will be assigned to instead of
|
||||||
|
displayed.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
include_php was added to Smarty 1.5.0.
|
include_php was added to Smarty 1.5.0.
|
||||||
@@ -2445,7 +2447,7 @@ index.tpl
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="builtin.function.insert">
|
<sect2 id="builtin.functions.insert">
|
||||||
<title>insert</title>
|
<title>insert</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=3>
|
<tgroup cols=3>
|
||||||
@@ -2656,7 +2658,7 @@ OUTPUT:
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="builtin.function.literal">
|
<sect2 id="builtin.functions.literal">
|
||||||
<title>literal</title>
|
<title>literal</title>
|
||||||
<para>
|
<para>
|
||||||
Literal tags allow a block of data to be taken literally,
|
Literal tags allow a block of data to be taken literally,
|
||||||
@@ -2690,7 +2692,7 @@ OUTPUT:
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="builtin.function.php">
|
<sect2 id="builtin.functions.php">
|
||||||
<title>php</title>
|
<title>php</title>
|
||||||
<para>
|
<para>
|
||||||
php tags allow php to be embedded directly into the template. They
|
php tags allow php to be embedded directly into the template. They
|
||||||
@@ -6094,6 +6096,47 @@ Pretty easy isn't it?
|
|||||||
|
|
||||||
Stock Name: {$ticker_name} Stock Price: {$ticker_price}
|
Stock Name: {$ticker_name} Stock Price: {$ticker_price}
|
||||||
|
|
||||||
|
</programlisting>
|
||||||
|
</example>
|
||||||
|
<para>
|
||||||
|
As of Smarty 1.5.0, there is even a cleaner way. You can include php in
|
||||||
|
your templates with the {include_php ...} tag. This way you can keep
|
||||||
|
your PHP logic separated from the template logic. See the <link
|
||||||
|
linkend="builtin.functions.include.php">include_php</link> function for
|
||||||
|
more information.
|
||||||
|
</para>
|
||||||
|
<example>
|
||||||
|
<title>componentized template with include_php</title>
|
||||||
|
<programlisting>
|
||||||
|
|
||||||
|
load_ticker.php
|
||||||
|
---------------
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// setup our function for fetching stock data
|
||||||
|
function fetch_ticker($symbol,&$ticker_name,&$ticker_price) {
|
||||||
|
// put logic here that fetches $ticker_name
|
||||||
|
// and $ticker_price from some resource
|
||||||
|
}
|
||||||
|
|
||||||
|
// call the function
|
||||||
|
fetch_ticker("YHOO",$ticker_name,$ticker_price);
|
||||||
|
|
||||||
|
// assign template variables
|
||||||
|
$this->assign("ticker_name",$ticker_name);
|
||||||
|
$this->assign("ticker_price",$ticker_price);
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
index.tpl
|
||||||
|
---------
|
||||||
|
|
||||||
|
{* Smarty *}
|
||||||
|
|
||||||
|
{include_php file="load_ticker.php"}
|
||||||
|
|
||||||
|
Stock Name: {$ticker_name} Stock Price: {$ticker_price}
|
||||||
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
Reference in New Issue
Block a user