Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
append()
2
 
3
append an element to an assigned array
4
 
5
Description
6
===========
7
 
8
void
9
 
10
append
11
 
12
mixed
13
 
14
var
15
 
16
void
17
 
18
append
19
 
20
string
21
 
22
varname
23
 
24
mixed
25
 
26
var
27
 
28
bool
29
 
30
merge
31
 
32
If you append to a string value, it is converted to an array value and
33
then appended to. You can explicitly pass name/value pairs, or
34
associative arrays containing the name/value pairs. If you pass the
35
optional third parameter of TRUE, the value will be merged with the
36
current array instead of appended.
37
 
38
NOTE.PARAMETER.MERGE
39
 
40
 
41
    <?php
42
    // This is effectively the same as assign()
43
    $smarty->append('foo', 'Fred');
44
    // After this line, foo will now be seen as an array in the template
45
    $smarty->append('foo', 'Albert');
46
 
47
    $array = array(1 => 'one', 2 => 'two');
48
    $smarty->append('X', $array);
49
    $array2 = array(3 => 'three', 4 => 'four');
50
    // The following line will add a second element to the X array
51
    $smarty->append('X', $array2);
52
 
53
    // passing an associative array
54
    $smarty->append(array('city' => 'Lincoln', 'state' => 'Nebraska'));
55
    ?>
56
 
57
 
58
 
59
See also [`appendByRef()`](#api.append.by.ref),
60
[`assign()`](#api.assign) and
61
[`getTemplateVars()`](#api.get.template.vars)