ReJump


Chapter 3:: Manual:: ReJump DataFile
Technology



 


Home

Datafile
About
News
Manual
<...
Chapter 3
...>
Download
Contacts








Data selection

ReJump system has built-in functions. They allow to get stored in file system data (for example in the folder "data").

It would be quite useful to learn about expressions and objects before the reader starts to read this material.

Expressions could be used only in templates.
Syntax of expression including into template looks as follows: <&expression>.

In ReJump system objects are files. They are designated in the following way:
data-folder-object--extension

"data-" is data marker. All data objects begin from this line.

"folder-object--extension" - this is path to the object (file) starting from root folder "data".

"folder" - path to folder, where the object (file) is stored.
"object--extension" - file name. The delimiter dot "." was replaced on "--" there.

Assume that there is file on the disk "./data/guestbook/12.mes"
To apply to that file you should write the following expression: "data-guestbook-12--mes"

On the way symbol "/" changes on "-".

Point the path only relative to catalog which was set with variable "$dataPath" in the configuration file (see section 1)

Folder is an object too. When you want to recieve the list of files which are in that folder the folder-object can be used. For example an expression <&data-guestbook:mes> returns a list of files with extension "mes" in that folder.

Operator ":" is used for that.

The result of expression processing will be enclosed in brackets parted with commas an object sequence.

Example:
{data-guestbook-0--mes,data-guestbook-admin--mes,data-guestbook-1--mes}

Notice, that file name could be any (in that example there are three files with extension "mes" in the folder: " 0.mes, 1.mes, admin.mes").

The file name can't be empty. Request from the example won't return the file with the name ".mes".

In the previous section we said about insertion function that allows to put the template into another one using <@template@> construction. "template" is the insertion line that points what exactly would be put in and its parameters.

Insertion line can have some parts.
The line example:
<@exmpl/data-guestbook-0--mes/data-guestbook-admin--mes@>
In that case "exmpl" is template (marker on template's fiel),
"data-guestbook-0--mes" and "data-guestbook-admin--mes" - markers and files.
In addition to markers you can use an integer numbers in the insertion line.
If you put in several objects and you want to number them you should write in the object's number in the list in the insertion line.
Example:
<@mes/data-guestbook-0--mes/1@>
<@mes/data-guestbook-admin--mes/2@>

Rules of insertion line walkthrough:
first parameter - template (in our examples "exmpl" and "mes")
following parameters - markers on filesand numbers. They will be numbered by the system as 1,2,3,4... and will be put into template instead of $1,$2,$3,$4. In that way data transfer into template happens. Transferred into template data could be used for new expressions formation.

Record "$number" serves for parameters in template recept.

Get back to the folder "data-guestbook". We know that <&data-guestbook:mes> calculates the list of files with extension "mes".
Assume that we want to put these files' contents into our main template in the form of table.
We can indicate it manually. It looks like:
<table>
<@mes/data-guestbook-0--mes/1@>
<@mes/data-guestbook-1--mes/2@>
<@mes/data-guestbook-admin--mes/3@>
</table>

At that template "mes" woild be looks like:
<tr><td>$2</td><td><&$1?Text></td></tr>
Expression <&$1?Text> includes file's contents, which was transferred in template as parameter "$1".
That constractio nis static. All files explicit pointed.
New file with extension "mes" won't be showed on our page (it needs to be pointed manually).

To make template "mes" an automatically calling template the construction <@<@> is used for every file.
Record looks as foolows:
<@data-guestbook:mes<mes/#1/%1@>
in that case system calculates the list which equals to
<&data-guestbook:mes>
For every element of the list template "mes" would be called and specific element of the list would be put in instead of "#1", and instead of "%1" - number of that element.

You can delimit rights of access to folders and files.
To select files from folders you need to have a right to reading.
In that case the folder is "data-guestbook".

How to get a right to reading?

Create file 0.read in the folder. Its contents must be "@<number>" (<number> equals value of parameter "$ANONYMS" in the file "rejump_df.conf". For example "1", example of record "@1")

There is the following hierarchy of rights in the system:
read - right to reading
write - right to reading and writing
master - right to reading, writing and to right modification

- There are several files with correspanding extensions "read", "write" and "master" to assign rights in folders. Name of these files doesn't mean anything, but it can't be empty.
- There is an object "ANONYMS" (variable "$ANONYMS" in the file "rejump_df.conf", see section 1). Give right to reading to this file and everybody will have it. Also you can give right to writing to that file, but giving right to writing to everybody is insecure.

Sign "@" as a first symbol in the file "0.read" means readdressing to the object (in that case object "1". In the example it equals "ANONYMS" - anonymous object). Object on which file "0.read" is readdressed could be not only number, but object "data-..." too.

Assume you have object "data-guestbook-admin". To give right to ownership to him you should create file "0.master" with the contents "@data-guestbook-admin". When you create file "0.write" you'll give the right to writing to the object indicated in that file.

You can create several files with extensions "read", "write" and "master". Thus it is possible to give rights to writing and reading to several objects.

If there is no any files with rights in the folder, system looks for them higher in catalogue.

To test our example with expression <&data-guestbook:mes> we need to create an object "0.read" ("@1") in the subfolder "guestbook" or in the root folder "$dataPath".

So we know that using construction <@<@> we can call the template for every file. In tha template we must write something (except those cases when we need only the file name).

Step by step:
<@data-guestbook:mes<mes_tpl/#1@>
calls template "mes_tpl" for every file with extension ".mes" in the folder "guestbook"
for example:
mes_tpl/data-guestbook-0--mes
As we set higher "#1" indicates that parameter is transmitted into template.

Write "$1" in template "mes_tpl" and get as a result object name - data-guestbook-0--mes.
<&$1?Text> - returns file's contents
<&$1?Name> - returns file name
In our case "0"
<&$1?Ext> - file extension
In our case "mes"

You can produce files' contents in the table in the following way:

template "index":

<table>
<@data-guestbook:mes<guestbook-mes_tpl/#1@>
</table>

Note, "guestbook-mes_tpl" is link on the template "mes" in the folder "guestbook". template "mes_tpl":

<tr><td>
<&$1?Text>
</td></tr>

Index
Download
Contacts
If you have any questions, please, contact us via email: datafile@rejump.com.


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