× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Both Reeve and Brad's arguments are similar, let me reply to both.

I mis-spoke when I referred to DDS keywords in RPG. I understand you can't use
DDS keywords in RPG, and was making a point. This makes an extremely clean
interface. As long as you want to move thing around and reformat a screen,
without changing/adding fields, you can do so in SDA without touching the RPG
program.

I guess my question becomes: If I considered the output formatting isolation
good before, why pick up bad habits because I'm programming for the Web?

As far as content and presentation are concerned, I think the same way about
stylesheets, also. Consider the "problem" of changing backround colors of
alternate table rows. If I define a stylesheet like the following:

.0 { background-color: white; }
.1 { background-color: cyan; }

and a CGIDEV2 template of:

/$tabledetail
<tr class="/%flipper%/"><td>/%somedata%/</td></tr>

I don't need to worry about style sheets while programming. I just do

d flipper s n inz(*off)
c eval flipper = *off
c* Processing some file
c dow not %eof
c call updhtmlvar('flipper':flipper)
c call updhtmlvar('somedata':field1)
c call wrtsection('tabledetail')
c eval flipper = not flipper
c read somefile
c enddo

Not only have I isolated the output from the logic, I have also isolated the
attributes.

If I want a field to have an optional attribute, (background color red
sometimes), I would just define a span tag for that attribute, and let the RPG
logic determine whether the class is used:

span.ok { background-color: white; }
span.negative { background-color: red; }

/$balanceinfo
Current balance: <span class="/%moneycolor%/">/%balance%/</span><br />

c if curbal >= 0
c callp updhtmlvar('moneycolor':'ok')
c else
c callp updhtmlvar('moneycolor':'negative')
c endif
c callp updhtmlvar('balance':'$'+%trim(%editc(curbal:'J')))
etc.

Some might ask why I use the dollar sign in RPG rather than in the template.
My answer is: 1) the dollar sign is part of the data. I might use a currency
lookup if I needed foreign currency translation, and output the appropriate
symbol. 2) I might choose not to output anything if the balance is zero, then
I don't have floating dollar signs in the resulting HTML.

I must make a concession. If I store paragraphs of text in a database (as I do
for my website), I do as Steve suggests, and translate newline characters to a
<br /> tag. I believe this is only necessary for embedded translations.

Please keep in mind that I'm looking beyond a single program when I mention
templates. If I have a web application consisting of multiple programs, I
would define a single template for the whole system and commonize elements.
This is the same reason you have multiple record formats in display files -
some elements (such as header/footer, static information) can be shared
between the formats.

I remember what my economics professor told us the first day of class. "If it
sounds good in theory but not in practice, then the theory's wrong." I'm not
saying that we *must* have 100% separation, but we should strive for it.
Except for the inline "newline to <br />" translation, the template theory has
held for me.

Loyd

--
"Why, you can even hear yourself think." --Hobbes
"This is making me nervous. Let's go in." --Calvin
loyd@blackrobes.net  ICQ#504581  http://www.blackrobes.net/


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.