added default modifier

This commit is contained in:
mohrt
2001-01-18 21:09:49 +00:00
parent 52e80776c6
commit 9ab75d02fb
3 changed files with 13 additions and 2 deletions

View File

@@ -127,6 +127,15 @@ function smarty_mod_strip_tags($string, $replace_with_space = true)
return strip_tags($string); return strip_tags($string);
} }
function smarty_mod_default($string,$default="")
{
if(empty($string))
return $default;
else
return $string;
}
/*============================================*\ /*============================================*\
Custom tag functions Custom tag functions
\*============================================*/ \*============================================*/

View File

@@ -77,7 +77,8 @@ class Smarty
'date_format' => 'smarty_mod_date_format', 'date_format' => 'smarty_mod_date_format',
'string_format' => 'smarty_mod_string_format', 'string_format' => 'smarty_mod_string_format',
'replace' => 'smarty_mod_replace', 'replace' => 'smarty_mod_replace',
'strip_tags' => 'smarty_mod_strip_tags' 'strip_tags' => 'smarty_mod_strip_tags',
'default' => 'smarty_mod_default'
); );
var $global_assign = array( 'SCRIPT_NAME' var $global_assign = array( 'SCRIPT_NAME'
); );

View File

@@ -77,7 +77,8 @@ class Smarty
'date_format' => 'smarty_mod_date_format', 'date_format' => 'smarty_mod_date_format',
'string_format' => 'smarty_mod_string_format', 'string_format' => 'smarty_mod_string_format',
'replace' => 'smarty_mod_replace', 'replace' => 'smarty_mod_replace',
'strip_tags' => 'smarty_mod_strip_tags' 'strip_tags' => 'smarty_mod_strip_tags',
'default' => 'smarty_mod_default'
); );
var $global_assign = array( 'SCRIPT_NAME' var $global_assign = array( 'SCRIPT_NAME'
); );