File: introduction.rst

package info (click to toggle)
libtemplates-parser 25.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,404 kB
  • sloc: ada: 12,020; python: 658; makefile: 351; sh: 37
file content (64 lines) | stat: -rw-r--r-- 2,459 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
.. _Introduction:

************
Introduction
************

The templates parser package has been designed to parse files and to
replace some specific tags into these files by some specified values.

The main goal was to ease the development of Web servers. In CGI
(*Common Gateway Interface*) mode you have to write the HTML page in
the program (in Ada or whatever other languages) by using some specific
libraries or by using only basic output functions like Ada `Put_Line` for
example. This is of course not mandatory but by lack of a good library
every Web development end up doing just that.

The main problems with this approach are:


* It is painful to have to recompile the program each time you have
  a slight change to do in the design (center an image, change the border
  width of a table...)

* You have the design and the program merged together. It means that
  to change the design you must know the Ada language. And to change the
  Ada program you need to understand what is going on with all these
  inline HTML command.

* You can't use the nice tools to generate your HTML.


With the templates parser package these problems are gone. The code and
the design is **completely** separated. This is a very important
point. PHP or JSP have tried this but most of the time you have the
script embedded into the Web template. And worst you need to use another
language just for your Web development.


* The HTML page is separated from the program code. Then you can
  change the design without changing the code. Moreover when you fix the
  code you don't have to handle all the specific HTML output. And you do
  not risk to break the design.

* It is easier to work on the design and the program at the same time
  using the right people for the job.

* It reduces the number of *edit/build/test* cycles. Writing HTML
  code from a program is error prone.

* It is possible to use standard tools to produce the HTML.

* You don't have to learn a new language.

* The script is Ada, so here you have the benefit of all the Ada power.


In fact, the Ada program now simply computes some values, gets some data
from a database or whatever and then calls the templates parser to output
a page with the data displayed. To the templates parser you just pass
the template file name and an associative table.

It is even more convenient to have different displays with the same set
of data. You just have to provide as many templates as you like.