Reference - Data handling - last


App: manual - Page: miscellaneous/handling


App: regression/framework - Page: data/a_text_element_once_in_its_row_is_a_value_whatever_its_siblings_hold
PHP
HTML
data/a_text_element_once_in_its_row_is_a_value_whatever_its_siblings_hold.pad
Result
{data 'c'}<cities><city><town>Gent</town><town>Ghent</town></city><city><town>Brugge</town></city></cities>{/data}[{c last=1}{$town}{/c}]


App: regression/framework - Page: options/last_takes_from_the_other_end
PHP
HTML
options/last_takes_from_the_other_end.pad
Result
{data 'n'}
[1,2,3,4,5,6]
{/data}
{n last=2}
{$n},
{/n}


App: regression/framework - Page: options/last_zero_keeps_no_row_as_first_zero_does
PHP
HTML
options/last_zero_keeps_no_row_as_first_zero_does.pad
Result
{data 'u'}[1,2,3]{/data}[{u first=0}{$u}{/u}][{u last=0}{$u}{/u}][{u last=0, negative}{$u}{/u}][{u last=2}{$u}{/u}]


App: regression/framework - Page: options/negative_leaves_sort_reverse_and_shuffle_their_rows
PHP
HTML
options/negative_leaves_sort_reverse_and_shuffle_their_rows.pad
Result
{data 'n'}
[3,1,5,2,4]
{/data}
[{n where='$n gt 2', sort, negative}
{$n},
{/n}][{n first=2, reverse, negative}
{$n},
{/n}][{n sort, last=2, negative}
{$n},
{/n}][{n first=3, shuffle, negative}
x
{/n}]


App: regression/framework - Page: options/rows_keyed_by_number_keep_their_keys_under_every_handler
PHP
options/rows_keyed_by_number_keep_their_keys_under_every_handler.php
HTML
options/rows_keyed_by_number_keep_their_keys_under_every_handler.pad
Result
<?php

// A set keyed by id - the keys are part of the rows, {&key} names them - and a list, which
// stays a list: numbered from 0 again after the handler.

$ks = [ 10 => [ 'n' => 3 ], 20 => [ 'n' => 1 ], 30 => [ 'n' => 2 ] ];
$xs = [ 'a', 'b', 'c' ];

?>
first:[{ks first=2}{&key},{/ks}] last:[{ks last=2}{&key},{/ks}] reverse:[{ks reverse}{&key},{/ks}] sort:[{ks sort='n'}{&key},{/ks}] splice:[{ks splice='1|1'}{&key},{/ks}] trim:[{ks trim}{&key},{/ks}] left:[{ks trim, left}{&key},{/ks}] random:[{ks random=3, orderly}{&key},{/ks}] list:[{xs reverse}{&key}{$xs},{/xs}][{xs last=2}{&key}{$xs},{/xs}][{xs splice='0|1'}{&key}{$xs},{/xs}]


App: regression/framework - Page: properties/a_first_or_last_option_does_not_shadow_the_property_of_its_name
PHP
HTML
properties/a_first_or_last_option_does_not_shadow_the_property_of_its_name.pad
Result
{data 'xs'}
[1,2,3,4,5]
{/data}
{xs first=3}
{first@xs}<ul>{/first@xs}<li>{$xs}</li>{last@xs}</ul>{/last@xs}
{/xs}
{xs last=2}
{first@xs ? '[' : ''}{$xs}{last@xs ? ']' : ''}
{/xs}
{xs first=2}
{$first@xs}
{/xs}