[REBOL] template driven development? Re: Rebol Server Pages
From: petr:krenzelok:trz:cz at: 7-Oct-2002 8:27
Andrew Martin wrote:
>Here's %Test.rsp, a example Rebol Server Pages file:
>
><html>
><head><title>Test</title></head>
><body>
><h1>Test</h1>
><% random/seed now either random true [ %>
>Have a <b>nice</b> day!
><% ] [ %>
>Have a <b>lousy</b> day!
><% ] %>
><br/>
>The date and time now is: <% now %>
></body>
></html>
>
uhm, well - what's that? :-) Such kind of code it totally unacceptable
to me :-) I hope build-markup does not work that way??? Do you really
like the mixture of Rebol code and html that way? What will be the
result? Your visual editor will show both strings unless you upload your
page and let it be processed in production environment, where rebol is
installed.
What is more - as shown above - I can't imagine cooperation of
web-designer with scripter - we would have to be very close one to each
other on a daily basis and create mixtures of our work. My idea is to
find out better way - something like template driven, modular design. I
want web-designer to only mark some sections for me, and according to
them I would load and run certain code. I want to give web designer
maximal expression freedom, if possible.
Displaying date or time is a simple task, what I will probalby need is
to generate some database query results, whatever the database is
(initially rebol objects text files). My idea is that my friend does
compelete design, including table, where results are displayed. The
table will have one example element in it, so my friend will still be
able to see, how does result of his code looks like in visual editor,
but he will mark sections for me, e.g. <!--[table_1]-->, so I will be
able to look at my code repository to look, if there is any code named
section called "table_1".
Now the only question left for me to decide is - how complex such system
I want to be? Design examples:
Let's suppose typical news site with table columnar desing
(http://www.ann.lu , http://www.amiga.org )
1) Designer creates table layout and also desing of first item, marks
table and first item sections, e.g. <!--[Title]-->.....<!--[/Title]-->
or something like that, for my script to know where to enter db query
results. That is the simplest case, where I don't need to solve if there
is 1 or 10 results and everything gets iterated and displayed on one site
2) there can be of course the case where there is e.g. more than 20
results, and we want to display just first 10 and then some "Next" button
3) even more complicated case, where designer creates e.g. two columnar
design? He/she would have to specify me some additional info though, e.g.
<!--[Table_1 [2 10]]--> or even <!--[Table_1 [varX varY]]--> where both
variables could be user's selection on website
As for 2) and 3):
A) I am not sure it is worth the effort
B) So really noone thinks in the same terms as me? Why should I care
what design designer chooses? I want my code to operate independently of
design, if possible. Maybe some XML systems already solve such abstraction?
C) I am not sure I can inteligently enough cover the practical needs and
if in the end such system would not bring more complication than needed
... but I think I will try it anyway ...
Chris was so kind and provided me with few links. For those interested:
http://www.webreference.com/dlab/9809/modular.html
http://www.webreference.com/dlab/9809/
Articles are old, but many ideas still valid ...
Any other pointers or ideas will be appreciated :-)
Cheers,
-pekr-