Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
Inserts {#plugins.inserts}
2
=======
3
 
4
Insert plugins are used to implement functions that are invoked by
5
[`{insert}`](#language.function.insert) tags in the template.
6
 
7
string
8
 
9
smarty\_insert\_
10
 
11
name
12
 
13
array
14
 
15
\$params
16
 
17
object
18
 
19
\$template
20
 
21
The first parameter to the function is an associative array of
22
attributes passed to the insert.
23
 
24
The insert function is supposed to return the result which will be
25
substituted in place of the `{insert}` tag in the template.
26
 
27
 
28
    <?php
29
    /*
30
     * Smarty plugin
31
     * -------------------------------------------------------------
32
     * File:     insert.time.php
33
     * Type:     time
34
     * Name:     time
35
     * Purpose:  Inserts current date/time according to format
36
     * -------------------------------------------------------------
37
     */
38
    function smarty_insert_time($params, Smarty_Internal_Template $template)
39
    {
40
        if (empty($params['format'])) {
41
            trigger_error("insert time: missing 'format' parameter");
42
            return;
43
        }
44
        return strftime($params['format']);
45
    }
46
    ?>
47
 
48