Added 'first' and 'last' section properties.

This commit is contained in:
andrey
2001-03-02 21:57:46 +00:00
parent f760d2aa1c
commit 86808e9cee
3 changed files with 10 additions and 6 deletions

12
NEWS
View File

@@ -1,9 +1,9 @@
- split out compiling code to separate class for faster
template execution time (Monte)
- added unregister_modifier, documented (Monte)
- added unregister_function, documented (Monte)
- added fetch function, documented (Monte)
- added math function, documented (Monte)
- added 'first' and 'last' section properties. (Andrei)
- split out compiling code to separate class for faster template execution
time (Monte)
- added and documented unregister_modifier() and unregister_function() API
calls. (Monte)
- added and documented 'fetch' and 'math' functions. (Monte)
- added ability to index looped variables by section properties, e.g.
$foo.index_prev/bar. (Andrei)
- added index_prev and index_next section properties. (Andrei)

View File

@@ -491,6 +491,8 @@ function _compile_section_start($tag_args)
$output .= "{$section_props}['rownum'] = {$section_props}['index'] + 1;\n";
$output .= "{$section_props}['index_prev'] = {$section_props}['index'] - 1;\n";
$output .= "{$section_props}['index_next'] = {$section_props}['index'] + 1;\n";
$output .= "{$section_props}['first'] = ({$section_props}['index'] == 0);\n";
$output .= "{$section_props}['last'] = ({$section_props}['index'] == {$section_props}['loop']-1);\n";
$output .= "?>";

View File

@@ -491,6 +491,8 @@ function _compile_section_start($tag_args)
$output .= "{$section_props}['rownum'] = {$section_props}['index'] + 1;\n";
$output .= "{$section_props}['index_prev'] = {$section_props}['index'] - 1;\n";
$output .= "{$section_props}['index_next'] = {$section_props}['index'] + 1;\n";
$output .= "{$section_props}['first'] = ({$section_props}['index'] == 0);\n";
$output .= "{$section_props}['last'] = ({$section_props}['index'] == {$section_props}['loop']-1);\n";
$output .= "?>";