Chapter 4:: Manual:: ReJump DataFile



Chapter 4

List processing

Folders are used for information storage. Note, you use expression "folder:extension" to get a list of files (in the form of markers on them, see section 3).
There are special features to process the list.
As an illustration we would use already known example with a folder "guestbook" and extension "mes". In that case base expression looks like <&data-guestbook:mes>. It returns just enclosed in braces parted with commas list of objects.


In expression you can use the following functions:
See in examples how tp use it
<&data-guestbook:mes?Cnt> - returns quantiyt of objects in the list
Result: 3

<&data-guestbook:mes?ID> - returns the first object
Result: data-guestbook-0--mes

<&data-guestbook:mes?Pos(data-guestbook-0--mes)> - returns object position
Result: 1

<&data-guestbook:mes?Next(data-guestbook-0--mes)> - next object
Result: data-guestbook-admin--mes

<&data-guestbook:mes?Prev(data-guestbook-0--mes)> - previous object
Result: empty object

Features on object fetching:

<&data-guestbook:mes?on_page=20> - returns first 20 elements from the list
<&data-guestbook:mes?skip=2&on_page=10> - returns first 10 elements bstarting with 3-rd... (skip first 2)
<&data-guestbook:mes?desc> - returns elements from the list in the descending order (list is sorted in alphabetical order by the default)

It is possible to transmit result of fetching to templates as a parameter. Construction <@<@> is used for that meanings.
<@data-guestbook:mes?on_page=5<mes_tpl/#1@> using template "mes_tpl" it returns 5 objects.

Current position could be transmitted into template as a parameter "?skip" when template calling. Example <@/index/?skip=15@>. In template "$SKIP" would changed on "15". The record in template would look:
<@data-guestbook:mes?on_page=5&skip=$SKIP<mes_tpl/#1@>, returns objects starting with 15-th till 20-th.

List navigation.

Give link on previous and next parts of lists using construction <@&next<@>
<@data-guestbook:mes?on_page=5&skip=$SKIP&next<<a href="/index/?skip=$NEXT_SKIP">next</a>@>

Take it to pieces:
data-guestbook:mes - forms lis tof objects
?on_page=5&skip=$SKIP - move pointer on "$SKIP" positions (here 15) in the list and selects 5 elements.
&next - points to the following elements (here starting with 20=15+5)
< - delimiter
<a href="/index/?skip=$NEXT_SKIP">next</a> - this is what will be put in the template in the place of defined construction in case if objects are found. If there are less than 21 object nothing would be put in.
Instead of "$NEXT_SKIP" would be put in 20 (15+5).

You can get previous objects using "&prev" and "$PREV_SKIP" (here starting with 10-th).
Expression is
<@data-guestbook:mes?on_page=5&skip=$SKIP&prev<<a href="/index/?skip=$PREV_SKIP">prev</a>@>

Like manner parameter "skip" and "$SKIP" when template calling you can use parameter "on_page" when calling and "$ON_PAGE" in the template.
<@index/?skip=15@> is possible to modify

in template instead of

It allows to enter an additionalinformation.
Construction "&of" serves for numbers output
<@data-guestbook:mes?skip=$SKIP&on_page=$ON_PAGE&of<$OF_THIS ГЁГ§ $OF_CNT@>
result 16..20 of 42
42 - quantity of elements
"$OF_THIS" substitutes for values of the first and last elements (here 16..20)
"$OF_CNT" substitutes their major quantity

If you have any questions, please, contact us via email:

© 2002-2009 Алексей Мась, ReJump