mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 19:04:27 +02:00
minor tweaks
This commit is contained in:
@@ -85,7 +85,8 @@
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
You can also pass variables to included templates as attributes.
|
You can also pass variables to included templates as
|
||||||
|
<link linkend="language.syntax.attributes">attributes</link>.
|
||||||
Any variables explicitly passed to an included template as
|
Any variables explicitly passed to an included template as
|
||||||
attributes are only available within the scope of the included
|
attributes are only available within the scope of the included
|
||||||
file. Attribute variables override current template variables, in
|
file. Attribute variables override current template variables, in
|
||||||
@@ -170,6 +171,7 @@
|
|||||||
<para>
|
<para>
|
||||||
See also
|
See also
|
||||||
<link linkend="language.function.include.php">{include_php}</link>,
|
<link linkend="language.function.include.php">{include_php}</link>,
|
||||||
|
<link linkend="language.function.insert.php">{insert}</link>,
|
||||||
<link linkend="language.function.php">{php}</link>,
|
<link linkend="language.function.php">{php}</link>,
|
||||||
<link linkend="template.resources">Template Resources</link> and
|
<link linkend="template.resources">Template Resources</link> and
|
||||||
<link linkend="tips.componentized.templates">Componentized Templates</link>.
|
<link linkend="tips.componentized.templates">Componentized Templates</link>.
|
||||||
|
@@ -106,7 +106,7 @@
|
|||||||
script must be included first to make it work. The path can be
|
script must be included first to make it work. The path can be
|
||||||
either absolute, or relative to
|
either absolute, or relative to
|
||||||
<link linkend="variable.trusted.dir">$trusted_dir</link>. When <link
|
<link linkend="variable.trusted.dir">$trusted_dir</link>. When <link
|
||||||
linkend="variable.security">security is enabled</link>, the script
|
linkend="variable.security">$security</link> is enabled, the script
|
||||||
must reside in <link linkend="variable.trusted.dir">$trusted_dir</link>.
|
must reside in <link linkend="variable.trusted.dir">$trusted_dir</link>.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
@@ -125,6 +125,10 @@
|
|||||||
weather, search results, user feedback areas, etc.
|
weather, search results, user feedback areas, etc.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.function.include">{include}</link>
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -6,9 +6,9 @@
|
|||||||
{ldelim} and {rdelim} are used for
|
{ldelim} and {rdelim} are used for
|
||||||
<link linkend="language.escaping">escaping</link>
|
<link linkend="language.escaping">escaping</link>
|
||||||
template delimiters, by default
|
template delimiters, by default
|
||||||
"{" or "}". You can also use <link
|
"{" and "}". You can also use <link
|
||||||
linkend="language.function.literal">{literal}{/literal}</link> to escape
|
linkend="language.function.literal">{literal}{/literal}</link> to escape
|
||||||
blocks of text.
|
blocks of text eg Javascript or css.
|
||||||
See also <link
|
See also <link
|
||||||
linkend="language.variables.smarty.ldelim">{$smarty.ldelim}</link>.
|
linkend="language.variables.smarty.ldelim">{$smarty.ldelim}</link>.
|
||||||
</para>
|
</para>
|
||||||
|
@@ -47,7 +47,8 @@
|
|||||||
See also
|
See also
|
||||||
<link linkend="variable.php.handling">$php_handling</link>,
|
<link linkend="variable.php.handling">$php_handling</link>,
|
||||||
<link linkend="language.function.include.php">{include_php}</link>,
|
<link linkend="language.function.include.php">{include_php}</link>,
|
||||||
<link linkend="language.function.include">{include}</link> and
|
<link linkend="language.function.include">{include}</link>,
|
||||||
|
<link linkend="language.function.insert">{insert}</link> and
|
||||||
<link linkend="tips.componentized.templates">Componentized Templates</link>.
|
<link linkend="tips.componentized.templates">Componentized Templates</link>.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@@ -67,7 +67,7 @@ function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=n
|
|||||||
$CacheID = md5($tpl_file.$cache_id.$compile_id);
|
$CacheID = md5($tpl_file.$cache_id.$compile_id);
|
||||||
|
|
||||||
if(! $link = mysql_pconnect($db_host, $db_user, $db_pass)) {
|
if(! $link = mysql_pconnect($db_host, $db_user, $db_pass)) {
|
||||||
$smarty_obj->_trigger_error_msg("cache_handler: could not connect to database");
|
$smarty_obj->_trigger_error_msg('cache_handler: could not connect to database');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mysql_select_db($db_name);
|
mysql_select_db($db_name);
|
||||||
@@ -77,14 +77,14 @@ function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=n
|
|||||||
// read cache from database
|
// read cache from database
|
||||||
$results = mysql_query("select CacheContents from CACHE_PAGES where CacheID='$CacheID'");
|
$results = mysql_query("select CacheContents from CACHE_PAGES where CacheID='$CacheID'");
|
||||||
if(!$results) {
|
if(!$results) {
|
||||||
$smarty_obj->_trigger_error_msg("cache_handler: query failed.");
|
$smarty_obj->_trigger_error_msg('cache_handler: query failed.');
|
||||||
}
|
}
|
||||||
$row = mysql_fetch_array($results,MYSQL_ASSOC);
|
$row = mysql_fetch_array($results,MYSQL_ASSOC);
|
||||||
|
|
||||||
if($use_gzip && function_exists("gzuncompress")) {
|
if($use_gzip && function_exists('gzuncompress')) {
|
||||||
$cache_content = gzuncompress($row["CacheContents"]);
|
$cache_content = gzuncompress($row['CacheContents']);
|
||||||
} else {
|
} else {
|
||||||
$cache_content = $row["CacheContents"];
|
$cache_content = $row['CacheContents'];
|
||||||
}
|
}
|
||||||
$return = $results;
|
$return = $results;
|
||||||
break;
|
break;
|
||||||
@@ -102,7 +102,7 @@ function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=n
|
|||||||
'".addslashes($contents)."')
|
'".addslashes($contents)."')
|
||||||
");
|
");
|
||||||
if(!$results) {
|
if(!$results) {
|
||||||
$smarty_obj->_trigger_error_msg("cache_handler: query failed.");
|
$smarty_obj->_trigger_error_msg('cache_handler: query failed.');
|
||||||
}
|
}
|
||||||
$return = $results;
|
$return = $results;
|
||||||
break;
|
break;
|
||||||
@@ -110,12 +110,12 @@ function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=n
|
|||||||
// clear cache info
|
// clear cache info
|
||||||
if(empty($cache_id) && empty($compile_id) && empty($tpl_file)) {
|
if(empty($cache_id) && empty($compile_id) && empty($tpl_file)) {
|
||||||
// clear them all
|
// clear them all
|
||||||
$results = mysql_query("delete from CACHE_PAGES");
|
$results = mysql_query('delete from CACHE_PAGES');
|
||||||
} else {
|
} else {
|
||||||
$results = mysql_query("delete from CACHE_PAGES where CacheID='$CacheID'");
|
$results = mysql_query("delete from CACHE_PAGES where CacheID='$CacheID'");
|
||||||
}
|
}
|
||||||
if(!$results) {
|
if(!$results) {
|
||||||
$smarty_obj->_trigger_error_msg("cache_handler: query failed.");
|
$smarty_obj->_trigger_error_msg('cache_handler: query failed.');
|
||||||
}
|
}
|
||||||
$return = $results;
|
$return = $results;
|
||||||
break;
|
break;
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<link linkend="language.function.include">{include}</link>
|
<link linkend="language.function.include">{include}</link>
|
||||||
and <link linkend="language.function.fetch">{fetch}</link>
|
and <link linkend="language.function.fetch">{fetch}</link>
|
||||||
use this when
|
use this when
|
||||||
<link linkend="variable.security">security is enabled</link>.
|
<link linkend="variable.security">$security</link> is enabled.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
See also
|
See also
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<title>$security_settings</title>
|
<title>$security_settings</title>
|
||||||
<para>
|
<para>
|
||||||
These are used to override or specify the security settings when
|
These are used to override or specify the security settings when
|
||||||
<link linkend="variable.security">security is enabled</link>.
|
<link linkend="variable.security">$security</link> is enabled.
|
||||||
These are the possible settings:
|
These are the possible settings:
|
||||||
</para>
|
</para>
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
@@ -18,7 +18,7 @@ These are the possible settings:
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
IF_FUNCS - This is an array of the names of permitted PHP functions in
|
IF_FUNCS - This is an array of the names of permitted PHP functions in
|
||||||
<link linkend="language.function.if">IF</link> statements.
|
<link linkend="language.function.if">{if}</link> statements.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@@ -39,10 +39,11 @@ $smarty->caching = true;
|
|||||||
|
|
||||||
function remaining_seconds($params, &$smarty) {
|
function remaining_seconds($params, &$smarty) {
|
||||||
$remain = $params['endtime'] - time();
|
$remain = $params['endtime'] - time();
|
||||||
if ($remain >=0)
|
if($remain >= 0){
|
||||||
return $remain . " second(s)";
|
return $remain . ' second(s)';
|
||||||
else
|
}else{
|
||||||
return "done";
|
return 'done';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$smarty->register_function('remaining', 'remaining_seconds', false, array('endtime'));
|
$smarty->register_function('remaining', 'remaining_seconds', false, array('endtime'));
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<sect1 id="plugins.inserts"><title>Inserts</title>
|
<sect1 id="plugins.inserts"><title>Inserts</title>
|
||||||
<para>
|
<para>
|
||||||
Insert plugins are used to implement functions that are invoked by
|
Insert plugins are used to implement functions that are invoked by
|
||||||
<link linkend="language.function.insert"><command>insert</command></link>
|
<link linkend="language.function.insert">{insert}</link>
|
||||||
tags in the template.
|
tags in the template.
|
||||||
</para>
|
</para>
|
||||||
<funcsynopsis>
|
<funcsynopsis>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
The insert function is supposed to return the result which will be
|
The insert function is supposed to return the result which will be
|
||||||
substituted in place of the <command>insert</command> tag in the
|
substituted in place of the <command>{insert}</command> tag in the
|
||||||
template.
|
template.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
|
Reference in New Issue
Block a user