mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 11:24:27 +02:00
update parameters for is_cached and fetch
This commit is contained in:
108
docs.sgml
108
docs.sgml
@@ -669,6 +669,7 @@ $smarty->clear_all_cache();
|
|||||||
<funcprototype>
|
<funcprototype>
|
||||||
<funcdef>void <function>is_cached</function></funcdef>
|
<funcdef>void <function>is_cached</function></funcdef>
|
||||||
<paramdef>string <parameter>template</parameter></paramdef>
|
<paramdef>string <parameter>template</parameter></paramdef>
|
||||||
|
<paramdef>[string <parameter>cache_id</parameter>]</paramdef>
|
||||||
</funcprototype>
|
</funcprototype>
|
||||||
</funcsynopsis>
|
</funcsynopsis>
|
||||||
<para>
|
<para>
|
||||||
@@ -701,11 +702,11 @@ $smarty->display("index.tpl");
|
|||||||
|
|
||||||
$smarty->caching = true;
|
$smarty->caching = true;
|
||||||
|
|
||||||
if(!$smarty->is_cached("index.tpl","CACHEID")) {
|
if(!$smarty->is_cached("index.tpl","FrontPage")) {
|
||||||
// do database calls, assign vars here
|
// do database calls, assign vars here
|
||||||
}
|
}
|
||||||
|
|
||||||
$smarty->display("index.tpl","CACHEID");
|
$smarty->display("index.tpl","FrontPage");
|
||||||
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
@@ -787,6 +788,7 @@ $smarty->display("index.tpl");
|
|||||||
<funcprototype>
|
<funcprototype>
|
||||||
<funcdef>string <function>fetch</function></funcdef>
|
<funcdef>string <function>fetch</function></funcdef>
|
||||||
<paramdef>string <parameter>template</parameter></paramdef>
|
<paramdef>string <parameter>template</parameter></paramdef>
|
||||||
|
<paramdef>[string <parameter>cache_id</parameter>]</paramdef>
|
||||||
</funcprototype>
|
</funcprototype>
|
||||||
</funcsynopsis>
|
</funcsynopsis>
|
||||||
<para>
|
<para>
|
||||||
@@ -1448,15 +1450,15 @@ OUTPUT:
|
|||||||
|
|
||||||
id: 1000<br>
|
id: 1000<br>
|
||||||
name: John Smith<br>
|
name: John Smith<br>
|
||||||
address: 253 N 45th
|
address: 253 N 45th<br>
|
||||||
<p>
|
<p>
|
||||||
id: 1001<br>
|
id: 1001<br>
|
||||||
name: Jack Jones<br>
|
name: Jack Jones<br>
|
||||||
address: 417 Mulberry ln
|
address: 417 Mulberry ln<br>
|
||||||
<p>
|
<p>
|
||||||
id: 1002<br>
|
id: 1002<br>
|
||||||
name: Jane Munson
|
name: Jane Munson<br>
|
||||||
address: 5605 apple st
|
address: 5605 apple st<br>
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
@@ -1501,24 +1503,24 @@ OUTPUT:
|
|||||||
|
|
||||||
id: 1000<br>
|
id: 1000<br>
|
||||||
name: John Smith<br>
|
name: John Smith<br>
|
||||||
address: 253 N 45th
|
address: 253 N 45th<br>
|
||||||
home phone: 555-555-5555
|
home phone: 555-555-5555<br>
|
||||||
cell phone: 555-555-5555
|
cell phone: 555-555-5555<br>
|
||||||
e-mail: john@mydomain.com
|
e-mail: john@mydomain.com<br>
|
||||||
<p>
|
<p>
|
||||||
id: 1001<br>
|
id: 1001<br>
|
||||||
name: Jack Jones<br>
|
name: Jack Jones<br>
|
||||||
address: 417 Mulberry ln
|
address: 417 Mulberry ln<br>
|
||||||
home phone: 555-555-5555
|
home phone: 555-555-5555<br>
|
||||||
cell phone: 555-555-5555
|
cell phone: 555-555-5555<br>
|
||||||
e-mail: jack@mydomain.com
|
e-mail: jack@mydomain.com<br>
|
||||||
<p>
|
<p>
|
||||||
id: 1002<br>
|
id: 1002<br>
|
||||||
name: Jane Munson
|
name: Jane Munson<br>
|
||||||
address: 5605 apple st
|
address: 5605 apple st<br>
|
||||||
home phone: 555-555-5555
|
home phone: 555-555-5555<br>
|
||||||
cell phone: 555-555-5555
|
cell phone: 555-555-5555<br>
|
||||||
e-mail: jane@mydomain.com
|
e-mail: jane@mydomain.com<br>
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
|
|
||||||
@@ -2024,70 +2026,6 @@ OUTPUT:
|
|||||||
<option value="2001">2001</option>
|
<option value="2001">2001</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</programlisting>
|
|
||||||
</example>
|
|
||||||
</sect2>
|
|
||||||
<sect2>
|
|
||||||
<title>header</title>
|
|
||||||
<informaltable frame=all>
|
|
||||||
<tgroup cols=3>
|
|
||||||
<colspec colname=param>
|
|
||||||
<colspec colname=type>
|
|
||||||
<colspec colname=required>
|
|
||||||
<colspec colname=default>
|
|
||||||
<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>contents</entry>
|
|
||||||
<entry>string</entry>
|
|
||||||
<entry>Yes</entry>
|
|
||||||
<entry><emphasis>n/a</emphasis></entry>
|
|
||||||
<entry>The contents of the header to pass</entry>
|
|
||||||
</row>
|
|
||||||
</tbody>
|
|
||||||
</tgroup>
|
|
||||||
</informaltable>
|
|
||||||
<para>
|
|
||||||
<emphasis>header</emphasis> is a function that sends a raw header
|
|
||||||
string. For example, if your template is sending content intended
|
|
||||||
for a WAP (Wireless Access Protocol) device, you would need to send
|
|
||||||
a special header to indicate the type of content you are sending.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
TECHNICAL NOTE: Be sure you call {header ...}
|
|
||||||
<emphasis>before</emphasis> any output in your template, including
|
|
||||||
whitespace. Otherwise the header will not work as intended.
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>header</title>
|
|
||||||
<programlisting>
|
|
||||||
|
|
||||||
{* our template is outputting contents for WAP devices *}
|
|
||||||
{header contents="Content-type: text/vnd.wap.wml"}
|
|
||||||
|
|
||||||
<?xml version"1.0"?>
|
|
||||||
DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
|
|
||||||
"http://www.wapforum.org/DTD/wml_1.1.xml"
|
|
||||||
|
|
||||||
<wml>
|
|
||||||
<card id="card1" title="Example1">
|
|
||||||
<p>
|
|
||||||
{$now|date_format}
|
|
||||||
Welcome to my webpage!
|
|
||||||
</p>
|
|
||||||
</card>
|
|
||||||
</wml>
|
|
||||||
|
|
||||||
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
@@ -2209,7 +2147,7 @@ POLICE BEGIN CAMPAIGN TO RUNDOWN JAYWALKERS
|
|||||||
|
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
|
|
||||||
Feb 6,2001
|
Feb 6, 2001
|
||||||
Tuesday, February 6, 2001
|
Tuesday, February 6, 2001
|
||||||
14:33:00
|
14:33:00
|
||||||
|
|
||||||
@@ -2343,7 +2281,7 @@ for a full list of valid specifiers.
|
|||||||
<title>default</title>
|
<title>default</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
|
||||||
{* this will display "no title" (without the qoutes) if $articleTitle is empty *}
|
{* this will display "no title" (without the quotes) if $articleTitle is empty *}
|
||||||
{$articleTitle|default:"no title"}
|
{$articleTitle|default:"no title"}
|
||||||
|
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
|
Reference in New Issue
Block a user