Index: openacs-4/packages/acs-templating/www/doc/exercise/ats-for-designers.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/exercise/ats-for-designers.adp,v
diff -u -N -r1.2.2.4 -r1.2.2.5
--- openacs-4/packages/acs-templating/www/doc/exercise/ats-for-designers.adp 22 Jun 2016 07:48:44 -0000 1.2.2.4
+++ openacs-4/packages/acs-templating/www/doc/exercise/ats-for-designers.adp 5 Jul 2016 12:14:22 -0000 1.2.2.5
@@ -3,6 +3,9 @@
This training module will teach largely by exercise and example,
but you should also refer regularly to the ATS documents provided and more specific
pointers will be given to help you out along the way. Okay, let's get to the nitty gritty. Okay, let's get to the nitty gritty. The basic building block of dynamic data in a template is the
onevalue variable. A variable
@@ -42,29 +45,29 @@
Exercise 1: Onevalues, onelists, multilists and
multirows Let's first take a look at some list and variable tags in
+ Let's first take a look at some list and variable tags in
action. Open up another browser and look at this page, which is a text rendition
of the The ACS Templating System for Web Designers
+
+Templating System : Templating
+Exercise
Reading
Exercises
(nestedlists, too?)/ats/doc/exercise/list-and-var-sample.tcl
page
-we'll be sourcing our data from; at the top of the page you'll find
-a block of commented text describing the variables generated by
-this page, followed by the actual code itself. Now, using your
-preferred text editor, open the file
+we'll be sourcing our data from; at the top of the page
+you'll find a block of commented text describing the variables
+generated by this page, followed by the actual code itself. Now,
+using your preferred text editor, open the file
list-and-var-sample.adp
located in the same directory
and compare the html script that you see there with the final
user-viewed page, list-and-var-sample.acs
.
Almost every .acs page the user sees is supported by one .tcl file
which supplies the data to be shown, and one .adp file specifying
-the format of it's presentation. Compare what you see in
+the format of it's presentation. Compare what you see in
list-and-var-sample.acs
with its supporting .adp file
and make note of the textual and structural differences between the
two, specifically:
.adp
file are designated with "\@" markers, like the
-\@name\@
variable that litters the opening text block of
-list-and-var-sample.adp
; here, \@name\@
is
-used as a place-marker for the value set in
+.adp
file are designated with "\@" markers,
+like the \@name\@
variable that litters the opening text
+block of list-and-var-sample.adp
; here,
+\@name\@
is used as a place-marker for the value set in
list-and-var.sample.tcl
your_multirow
.
Now since the variable marker \@name\@
is set in
list-and-var-sample.tcl
, you can go ahead and edit
-that file to replace "(Your Name)
" with whatever your
-name really is (be sure to leave the quotes); if you wish,edit some
-of the other values to personalize the page. You'll see your
-changes take effect upon saving the .tcl file and reloading
-list-and-var-sample.acs
. In general, though, you
-should probably not be editing .tcl files unless you have a pretty
-good sense of their innerworkings.
(Your Name)
" with
+whatever your name really is (be sure to leave the quotes); if you
+wish,edit some of the other values to personalize the page.
+You'll see your changes take effect upon saving the .tcl file
+and reloading list-and-var-sample.acs
. In general,
+though, you should probably not be editing .tcl files unless you
+have a pretty good sense of their innerworkings.
Okay, now go back to the web browser in which you are viewing
-list-and-var-sample.acs
and change the ".acs"
-extension to ".dat". This
-page displays a view of datasources generated in the .tcl file that
-can be used in your .adp template (actually, the information is
-generated from commented text parsed from the top of the .tcl file,
-so you can view this information in either the .dat page or
-straight from the .tcl file). Go ahead and make use of the
-datasource variables not already included in the .adp file;
-specifically, change list-and-var-sample.adp
so
-that:
list-and-var-sample.acs
and change the
+".acs" extension to ".dat". This page displays a view
+of datasources generated in the .tcl file that can be used in your
+.adp template (actually, the information is generated from
+commented text parsed from the top of the .tcl file, so you can
+view this information in either the .dat page or straight from the
+.tcl file). Go ahead and make use of the datasource variables not
+already included in the .adp file; specifically, change
+list-and-var-sample.adp
so that:
Congratulations! You've just created a personalized web page -describing friends you've never met and movies you've possibly -never seen.
-Exercise Two: <if> and <else>, the conditional -tags
+Congratulations! You've just created a personalized web page +describing friends you've never met and movies you've +possibly never seen.
+Exercise Two: <if> and <else>, the +conditional tags
Dynamic data implies a changing page, and also changing presentation. The <if> and <else> tags allow you to alter the format of your page to @@ -129,28 +131,31 @@
<if \@a\@ between \@b\@ \@c\@>
requires that
-\@a\@
is greater than or equal to \@b\@
and less than or equal to \@c\@
; so <if
-\@x\@ between 4 2>
will always test false\@a\@
is greater than or equal to \@b\@
and less than or equal to \@c\@
; so
+<if \@x\@ between 4 2>
will always test falseNow, alter a few of the <if> tags in
list-and-var-samle.adp
and add a few of your own.
Specifically, add one <if> and <else> combination so
that the friend description reads "likes chocolate" when
-likes_chocolate_p
is "t", "doesn't like chocolate"
-when likes_chocolate_p
is "f", or "probably like
-chocolate" if likes_chocolate_p
is an empty string.
-Also, add one <if>, and one <if> only, so that a
-is appropriately changed to an for any 11-, 18- or 80- to
+likes_chocolate_p
is "t", "doesn't
+like chocolate" when likes_chocolate_p
is
+"f", or "probably like chocolate" if
+likes_chocolate_p
is an empty string. Also, add one
+<if>, and one <if> only, so that a is
+appropriately changed to an for any 11-, 18- or 80- to
89-year olds.
Exercise Three: The <master> and <slave> tags -- -a call to the dominatrix in you
+Exercise Three: The <master> and <slave> +tags -- a call to the dominatrix in you
The <master> and <slave> tags allow you to maintain a consistent style and format among pages without having @@ -176,22 +181,22 @@ within a master tag already formatted for HTML
Now that the secrets of <master> and <slave> have
-been revealed, it's time to put a little of your newfound knowledge
-to use. Open up form-sample.adp
, a standalone,
+been revealed, it's time to put a little of your newfound
+knowledge to use. Open up form-sample.adp
, a standalone,
independently formatted html page, and enslave it to the mastery of
of your personal web page. It would also be nice if you were to
label the newly inserted form with some slave-specific title.
Practice using <formwidget> and <formgroup> by adding the missing entry fields manually into the form. Make free use of any HTML properties to streamline the form to your liking. -If you can't remember what those fields were you can replace the -closing </formtemplate> tag to recover the default format, or -make use of the .dat datasource page to view your developer's -description and comments about the form.
-Also, try customizing your form's error response/correction -request text. You'll need to use the <formerror> tag, an example of +If you can't remember what those fields were you can replace +the closing </formtemplate> tag to recover the default +format, or make use of the .dat datasource page to view your +developer's description and comments about the form.
+Also, try customizing your form's error response/correction +request text. You'll need to use the <formerror> tag, an example of which can be found under the gender formwidget.
Exercise Five: more fun with multirows
-Now that you've confidently added the conditional <if> and -<else> tags to your ATS toolbelt, it's time to put those -tools to good use in formatting multirow data. First, read the -docs to learn about the +
Now that you've confidently added the conditional <if>
+and <else> tags to your ATS toolbelt, it's time to put
+those tools to good use in formatting multirow data. First, read
+the docs to learn about the
automatcally generated \@your_multirow.rownum\@
column, the \@your_multirow:rowcount\@
onevalue
which contains the total number of rows contained in your multirow,
and the <multiple> startrow
and
maxrows
attributes. Possible point of confusion: the
-variable \@your_multirow:rowcount\@
is a onevalue
-and not a column of the multirow your_multirow
,
-so it need not be used within <multiple> tags and in many
-cases should not be used within <multiple> tags. Why is this?
-(Take a look at how \@address:rowcount\@
is used.) Now
-make the following improvements to the address book listing you
-found in form-sample.acs
:
\@your_multirow:rowcount\@
is a
+onevalue and not a column of the multirow
+your_multirow
, so it need not be used within
+<multiple> tags and in many cases should not be used within
+<multiple> tags. Why is this? (Take a look at how
+\@address:rowcount\@
is used.) Now make the following
+improvements to the address book listing you found in
+form-sample.acs
:
startrow
attribute so that the address