Changes between Version 3 and Version 4 of Doc/panc/stdtpl/functions
- Timestamp:
- Nov 30, 2007, 11:51:35 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Doc/panc/stdtpl/functions
v3 v4 12 12 Often one want to add elements to a resource (list or hash) incrementally with a sequence of assignment statements. Those assignment statements usually being in different templates. The following functions provide simple mechanisms to do so. 13 13 14 '''push(element...)''' 14 === push(element...) === 15 15 16 16 This function will return a copy of self with the given value(s) appended to the end. If self is undefined, the function will create a new list with the arguments and return that. An example is … … 30 30 will leave '/mylist' with the one-element list 'b'. 31 31 32 '''push_if(boolean, element...)''' 32 === push_if(boolean, element...) === 33 33 34 34 This function behaves exactly like push() except that the first argument determines whether or not to add the rest of the arguments to the value of self. If the value is false, the function will return an empty list. As for push(), this function will create a new list if self is undefined. See also the warning about multiple calls to push() within the same DML block; this warning also applies here. 35 35 36 '''npush(element...)''' 36 === npush(element...) === 37 37 38 38 This function will return a copy of self with the given value(s) inserted into the nlist. The number of arguments must be even; each pair will be treated as a key/value. If self is undefined, the function will create a new nlist with the arguments and return that. An example is … … 54 54 55 55 == 'object' Utility Functions == 56 57