Smutty

MVC Framework

View Code: function.notice

Browse: All · Classes · Plugins

1
<?php
2
3
/**
4
* returns the html for displaying a brief notice on the page
5
*
6
* @param array $params the parameters
7
* @param Smarty $smarty the smarty object
8
* @return html
9
*
10
*/
11
12
function smutty_function_notice( $params, $smarty ) {
13
14
$smarty->depend( 'modifier', 'escape' );
15
16
$type = w( $params,'type','div' );
17
$text = v( $params, 'text' );
18
$id = w( $params, 'id', 'NOTICE' . rand() );
19
$delay = w( $params, 'delay', 5000 );
20
$html = '';
21
22
$html = Smutty_Smarty::htmlElement( $type, array(
23
'class' => v( $params, 'class' ),
24
'id' => $id
25
), $smarty );
26
27
$html .= smarty_modifier_escape($text) . "</$type>" .
28
'<script type="text/javascript">' .
29
'setTimeout(\'document.getElementById(\\\'' . $id . '\\\').style.display=\\\'none\\\'\',' . $delay . ');' .
30
'</script>';
31
32
return $html;
33
34
}
35
36
function smarty_function_notice( $params, $smarty ) {
37
echo smutty_function_notice( $params, $smarty );
38
}
39
40
?>

The code shown here is the code that is currently running this site. If you want to view the latest SVN version of the code then go to the Subversion repository.