Hello, all!

We have a 4 year experience in developing web sites
for our customers. Most of these web sites must present
information stored in some relational database
(MySQL or Oracle), and we create a special web interface
for managing the data stored in the database.
We cannot use standard modules like DB::Editor,
because we need to provide a simple and easy-to-use
interface for end user.

We used to create such interface using Apache::ASP,
but that was incovenient because we could not
reuse code for different projects, and it required a programmer
and a usability specialist to work togather on such interface
which took up to 70% of the entire project.
Now we use Template Toolkit 2, it is more convenient
as we can define templates with common objects.
Some of these objects perform tasks related to database,
for example, updating or fetching data from the database,
other kind of objects are those that define
presentation of the document. So, we can reuse such objects,
but it is not very convenient. The main template
mostly consists of a lot of [% INCLUDE ... %] statements,
and we want to use some simplier syntax for this, like XML.

We tried to use XML, but the main problem with XML
is that we cannot insert even a simple logic constructions,
like IF of FOREACH, as with Template.

At this time, for this configuration file we use
a special XML-like syntax (it is not really an XML,
it is translated into TT2 with a our parser).
Here is an example of such page:
------------------------
<autorization_check>
<mysql_connect database="musica">

<edit sql="update banned_ip set ip=? where ip=?" params="ip old_ip">
<delete sql="delete from musica.banned where banned_ip = ?" params="old_ip">
<add sql="insert into musica.banned (banned_ip) values (?)" params="ip">

<rows=fetch sql="select banned_ip from banned order by banned_ip">

<page name="musica.mustdie.ru" title="Innards of musica" subtitle="Banned IP">
<add_table>
<row><th value="Ban new IP:"><inp name="ip" type="text" size="15"></row>
</add_table>

<edit_table>
<edit_title><th value="Banned IP" hint="Banned IP"></edit_title>
<FOREACH c=rows>
<row>
<inp name="ip" type="text" value=c.banned_ip size="15">
<inp name="old_ip" type="hidden" value=c.banned_ip>
</row>
</FOREACH>
<edit_title><th value="Banned IP" hint="Banned IP"></edit_title>
</edit_table>
</page>
----------------------------------
which is actually translated into
[% PROCESS autorization_check %]
[% mysql_connect({database=>"musica"}) %]
etc...

Our questions are:
1. Are there any mod-perl packages created for similar tasks?
2. Can constructions similar to
<FOREACH c=rows>
...
</FOREACH>

(which is now translated into [% FOREACH ... %] template blocks)
be implemented with standard XML parser?

-----
Best regards,
Alexander Efimov.
programmer of WebZavod
(http://www.webzavod.ru)


Reply via email to