The pre-processor will take care of HTML end tags. The flexible system of scripts binding is more powerful than SSI. It lets you easily create diverse module documents.
The abstract function is an analogy for a tag. Thus, the author of the Internet documents gets the advantage to expand the set of the commands he can use (like in XML).
dbPager is easy to learn, because it comprises small set of basic commands.
The commands have simple syntax and just 7 of them are mostly used. It allows you to learn and use dbPager very soon.
When applying to the external sources of data, dbPager uses Borland Database Engine (BDE 5.0). It enables you to work with wide variety of databases - from desk ones (like dBase and Paradox) to the server ones (as Oracle, MS SQL, Interbase)
The dbPager scripts are compiled in RAM while the first applying to them (the Just In Time Compiler method is used). Usage of the managed cache increases the efficiency even more.
The most efficient solution is offered for MS IIS, where dbPager is set as an ISAPI extension, but thanks to CGI implementation dbPager can be used on the servers of other producers.
Creating the dbPager's syntax there were many varieties tried , but finally the choice fell upon the little a bit unusual one. It reminds the Lisp language, but instead of parentheses it uses the structural positioning for the imbedded scripts. You use the "space" or the "tabulator" symbols before any "non-empty" symbol of a line.
Example:
-------------------------------------------- The most external line The subjected line #1 of the first level The subjected line #1 of the second level The subjected line #2 of the second level The subjected line #3 of the third level The subjected line #3 of the second level The subjected line #2 of the first level --------------------------------------------
The lines in the subjected levels are context dependent to the line they subjected to.
Every line of dbPager's script consists of the name of descriptor followed by its parameters (the list of descriptors you can see below). Besides of that every line is fulfilled according a specific context (in this case the context is a set of variables with their values). The descriptors can make their own context or change the existing one. You can apply to the context variables through the name of the variable put into "%" signs.
The line put into brackets fulfills math operations written in it.
Example:
-------------------------------------------- var "a=12","b=6" //to create the context variables #%a%+%b%*6=[%a%+%b%*6] //12+6*6=48 --------------------------------------------
In the case if there is no such variable in the context the line is remained "as it is" without been interpreted. In the formula processor "[]" you can construct the name of a variable and it will be interpreted.
Example:
-------------------------------------------- var "c126=qwerty","a=12","b=6" //creating of the context variables #c%a%%b%=[c%a%%b%] //c126=qwerty --------------------------------------------
To ease the work with imbedded constructions use
"space","colon","colon","space"
Example:
-------------------------------------------- line #1 //the complete record line #2 line #3 line #4 line #1 :: line #2 //the shortened record line #3 line #4 --------------------------------------------
Any part of a line after "//" is a comment. If the first "non-empty" symbols in a line are "//" the parser of the hierarchy doesn't consider the whole line. PRE-DEFINED VALUES AND VARIABLES During the start of dbPager's script, while the its own context hasn't been formed yet, the existing (current) context is not empty. It contains the variables of server, constant values, session's variables, the constant values from the setting file. This is the list of them:
Receiving the server request the dbPager processes the script and sends the result to the client. As default, it creates the standard reply header:
-------------------------------------------- HTTP/1.0 200 OK Pragma: no-cache Connection: Session_identifier Content-Type: text/html Content: --------------------------------------------
This header is appropriate for 99% of common HTML pages. Though, sometimes other headers may be required to transmit the NONE_TEXT data like pictures from the database. In order to show to dbPager that the graphic file is transmitted - the first line, sent to the client, must contain GIF symbol for the gif-data, or JPEG for the jpg-data.
Example:
-------------------------------------------- sql select image_type, image from images where id=%id% // request to the database #%image_type% // GIF or JPEG #%image% // binary data --------------------------------------------
Since dbPager 2.6 there is capability to generate images. "Redirect" is one more useful function - the banner systems work this way. The references are substituted for others. The next code with URL prefix can be used to make transition to the database and simultaneously to count the number of clicks:
-------------------------------------------- sql update catalog set hit_count=hit_count+1 where id=%id% // added to the counter sql select url from catalog where id=%id% // request to the database #URL %url% // redirect --------------------------------------------
If the situation doesn't fall under any of the described cases use ASIS prefix followed by your own header of response.
-------------------------------------------- @html("the day of the week") var "d1=Su","d2=Mo","d3=Tu","d4=We","d5=Th","d6=Fr","d7=Sa" // the days initiation <h3>The day of the week [d+day(now)] // the day output --------------------------------------------
In the user's functions expressions you use the following constructions:
-------------------------------------------- [... @ expression.f (expression.1, expression.2, ...) ...] --------------------------------------------
Where expression.f - is the name of the script with the point of entering, shown completely (may be calculated); in parentheses you define the arguments separated by comas. If the arguments are not needed you leave the parentheses empty.
The factorial calculation example:
-------------------------------------------- factorial.dbl: switch %arg1% #0 :: #1 #else :: #[%arg1%*@factorial(%arg1%-1)] --------------------------------------------
context - Creates new level of context variables
Syntax:
-------------------------------------------- context "name1=value1","name2=value2",... --------------------------------------------
In differ to the traditional programming language, the variables in dbPager can be created in any place within the program. The created variables exist only for imbedded levels of descriptors. They also called "the context dependent levels". If a new created variable has the same name as the old one then the new variables cover the old ones. When you exit the context dependent level, the variables restore their former values. If you need to use a variable included in a current context level you use the sign "^" presiding the variable's name. The several signs "^" in a raw allow you to apply to the more early levels.
Example:
-------------------------------------------- @html("A simple page") var "a=aaa","b=bbb" <p>The variables' values a=%a%, b=%b% // aaa bbb var "a=AAA","b=BBB" <p>The variables' values a=%a%, b=%b% // AAA BBB <p>The variables' values a=%^a%, b=%^b% // aaa bbb <p>The variables' values a=%a%, b=%b% // aaa bbb <p>the variables' values a=%a%, b=%b% // not defined --------------------------------------------
It demonstrates the overlapping of the contexts.
declare - To define the default variables' values
Syntax:
-------------------------------------------- declare "name1=value1","name2=value2",... --------------------------------------------
When the users' requests come to the program to be processed, quite often one or another variable is not defined. The declare descriptor creates the variables for those were not defined earlier.
Example test.dbp:
-------------------------------------------- @html("A simple page") var "a=aaa" <p>The variables' values a=%a%, b=%b% // The value of b is not defined default "a=AAA","b=BBB" <p>The variables' values a=%a%, b=%b% // aaa BBBB <p>The variables' values a=%a%, b=%b% // The value of b is not defined --------------------------------------------
If you apply to such script without the parameters the default values of
b will be used. If the user defines the value
(http://????/test.dbp?b=qwerty) then will be used the defined by the user value.
global - To define the variables of the session
Syntax:
-------------------------------------------- global "name1=value1","name2=value2",... --------------------------------------------
To transfer the data from one page to another you can use the parameters in URL or the data of a form. Sometimes it is not convenient (and not secure) way. dbPager allows to create the session user's variables. They created on the server in the context of the specific user. This variables are accessible in any place of the script. The rule of imbedded contexts isn't spread upon them.
Example:
-------------------------------------------- @html("A simple page") default "count=1" // The local initiating of the counter <p>You visited this page %count% times // the counter of visits global "count=[%count%+1]" // We change the global value of the counter --------------------------------------------
It outputs the number of a specific person's visits of a specific page (the own counter is created for every user). The values of the global variables are dropped down if the user's request doesn't come for more than 15 minutes.
set - To change the variables' values
Syntax:
-------------------------------------------- set "name1=value1","name2=value2",... --------------------------------------------
It changes only the values of variables on the current context level and doesn't touch "the overlapped" variables. To change the "the overlapped" variables' values you need to use one or more signs "^" preceding the variable's name (depending which level the variable belongs to).
Example:
-------------------------------------------- @html("A simple page") var "a=aaa","b=bbb" <p>The variables' values a=%a%, b=%b% // aaa bbb var "a=AAA","b=BBB" set "a=CCC","^b=zzz" <p>The variables' values a=%a%, b=%b% // CCC BBB <p>The variables' values a=%a%, b=%b% // aaa zzz --------------------------------------------
import - The sytaxs parser of the list
Syntax:
-------------------------------------------- import the_line --------------------------------------------
This descriptor is very similar with the context descriptor, but the format of the line is remained open - you even can place a variable which connect the list of the names with values. This descriptor can be used completely instead of context/var , but it doesn't work oposite way. The use of the descriptor is justified when you need to have the eccess to the group of named values recorded in a file or the field BLOB. This descriptor is used together with the export one.
export - To synthes the list with values
Syntax:
-------------------------------------------- export the_list_of_variables --------------------------------------------
It is convinient to use the BLOB field in saving data of arbitrary format into a database. You can record the data formated according the specific (understandable by an application program) rulles into these fields. This dedcriptor is used to form a line with variable=value,.... format. To restore the variables (backward) use the import dedcriptor.
-------------------------------------------- @html("A simple page") var "a=aaa","b=bbb","c=ccc" // To save data in the DB save table_name #123 // the key #data= :: export a,b,c <p>The variables' values a=%a%, b=%b%, c=%c% // aaa bbb ccc <p>The variables' values a=%a%, b=%b%, c=%c% // not defined // To restore the data form the DB sql select data from table_name where id=123 import %data% // sytax parsering <p>The variables' values a=%a%, b=%b%, c=%c% // aaa bbb ccc --------------------------------------------
split - To disassamble a string (line) into substings
Syntax:
-------------------------------------------- split "name=string","Sep=separator","Loop=N|Y|Pnn" --------------------------------------------
It is impossible to imagine the text processing without spliting the text lines into substrings. In dbPager only one descriptor is responsible for such operation, but in three modifications: the complete, the itterational and the positional. The complete one splits the strings into substrings separated by symbol-devider and the result is put into numbared variables (the numbers of them correspond with their order number in the line).
Example:
-------------------------------------------- @html("A simple page") var "a=aaa,bbb,ρρρ," split "aa=%a%","Sep=," <p>aa1=%aa1%, aa2=%aa2%, aa3=%aa3% <p>The number of substings = %Count% // 3 <p>The number of deviders = %SepCount% // 3 var "a=aaa,bbb,ρρρ" split "aa=%a%","Sep=," <p>aa1=%aa1%, aa2=%aa2%, aa3=%aa3% <p>The number of substings = %Count% // 3 <p>The number of deviders = %SepCount% // 2 --------------------------------------------
The number of substrings are in the Count and SepCount variables corespondently.
The itteration modification of the disctiptor is little more complecate. It contains an additional parameter Loop=Y and may contain the limitator of the range (similar to the sql descriptor). The following example outputs first ten lines from the text file:
-------------------------------------------- @html("A simple page") read test.txt split (0,10) "line=%file%","Sep=%CrLf%","Loop=Y" #%line% (the line #%line_no%)
--------------------------------------------
The position modification of the descriptor is useful in the cases when you need allocate the substring of a specific length from a text line. Generating the SQL operators is important for the stirng not to exceed the width of the column in the DB. You need to use the Loop=Pnn parameter where the nn is position in the string on which you devide the string into two ones. The parameter Sep=dividers is uesed for the "intillectual" way of division when the devision is done not in the specificly appointed place, but on the border of the words or sentences. As the deviders you show the symbols in the order of desended priority.
Example:
-------------------------------------------- @html("A simple page") var "str=123,45;67 890abcde" split "line=%str%","Sep=;, ","Loop=P12" #%line1% (the size %line1_size%)
// 123,45 (the size 6) #%line2% (the size %line2_size%)
// 67 890abcde (the size 11) split "line=%str%","Sep=,; ","Loop=P12" #%line1% (the size %line1_size%)
// 123 (the size 3) #%line2% (the size %line2_size%)
// 45;67 890abcde (the size 14) split "line=%str%","Sep=","Loop=P12" #%line1% (the size %line1_size%)
// 123,45;67 89 (the size 12) #%line2% (the size %line2_size%)
// 0abcde (the size 6) --------------------------------------------
substr - To substitude the substings
Syntax:
-------------------------------------------- split substr "Str=string","Sep=separator","Sub=substring" --------------------------------------------
If you need to cange one siquence of symbols in a sttring into another one you easely can do it with the substr descriptor. The Str parameter must contane the original string. The Sep parameter must contane the string you want to cange. The Sub parameter must contane the substitute. The result of the subsritute will be put into the new-created variable Str which exists only in the context of this specific descriptor. Below you can see the example how to change the quote marks into the symbol ". It is useful for the processing of the form's input field:
-------------------------------------------- @html("A simple page") var "a=Company ""My_company""" substr "Str=%a%","Sep=""","Sub="" <h3>%str% // Company "My_company" with the substituted quote marks --------------------------------------------
READ MORE OF THE DESCRIPTORS' MANUAL
About SQL and so on...
OR...
BACK HOME |