How to Read the Reference Guide
Dispatch tags are presented in the following format:
<dpHeadline
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
The above syntax format should be read as follows:
Right: <dpHeadline style="upper" style="spaced">Wrong: <dpHeadline style="upper|spaced">
For comparison reference. The HTML <img> tag would be documented like this.
Only a portion of the attributes are being used for this example.
<img
src = "URL"
align = "left|right|top|middle|bottom"
alt = "default text"
width = "#"
height = "#"
>
Usually after the syntax of a tag is listed, its unique attributes are then defined. Frequently you will see a comment that says: "Please refer to the common attributes page for common attribute descriptions." The common attributes have been combined to a separate page to conserve space throughout the reference guide. To read about these attributes, follow the link as suggested.
D I S P A T C H T A G S Y N T A X R U L E S
Dispatch tags have similar syntax rules to HTML. If you can do it with HTML, you can probably do it with Dispatch tags.
Rules similar to HTML
Additional Rules
<meta name="keywords" content="<dpMetaKeywords>"><a href="<dpPageForwardUrl>">Page Forward</a>
Common Attributes
The common attributes are attributes that are common to most Dispatch tags. These attributes are: default, style, link, start, stop and length
Examples:
If a story has an author, the <dpAuthor> tag will display it as usual. You can also use the default attribute for the scenario of a story without an author.
| <dpAuthor default="Staff Writer"> | Staff Writer |
| <dpAuthor default="Anonymous"> | Anonymous |
An example of the default attribute used within the <dpHeadline> tag. Notice the use of nesting a tag within a tag.
| <dpHeadline default="<dpColumn>"> | Cinema Review |
In the following example, if the story has a summary, it is displayed as usual. If the story doesn't have a summary the default value is used. In this case the default value is the first two sentences of the story, followed by an ellipses.
| <dpSummary default="<dpStory length="2s">..."> | What's left to be said about Woody Allen? Or maybe the question is, "What does Woody have left to say?"... |
style="lower" - converts to "lower case".
style="upper" - converts to "UPPER CASE".
style="title" - converts to "Title Case". Note: use title case with caution. Due to the complexities of the English language, it may not always be 100% accurate.
style="spaced" - adds a space between each character. "s p a c e d"
style="roman" - converts to roman numeral: IX
style="decimal" - converts to decimal: 9
style="noHtml" - removes all HTML.
style="noHtmlStyle" - removes all HTML except paragraphs <p> and breaks <br>.
style="identifier" - converts to lower case letters with no spaces. This is primarily used for creating file names.
style="scriptEncode" - converts quotes, commas, and apostrophes to their numeric ASCII values. Primarily used within JavaScript or other scripting languages.
style="uriEncode" - encodes the text so it can be passed through a URL. This is often used for passing a query string on to an external search engine or commerce site.
style="chef", style="cockney", style="fudd", style="jive", style="kraut", style="newspeak", style="valspeak" - dialect translator Easter eggs. Read more about these here
Examples:
| <dpHeadline> | Censored stories, 1998 |
| <dpHeadline style="lower"> | censored stories, 1998 |
| <dpHeadline style="upper"> | CENSORED STORIES, 1998 |
| <dpHeadline style="title"> | Censored Stories, 1998 |
| <dpHeadline style="spaced"> |
|
| <dpHeadline style="roman"> | Censored stories, MCMXCVIII |
| <dpHeadline style="decimal"> | Censored stories, 1998 |
| <dpHeadline style="spaced" style="upper"> |
|
| <dpHeadline style="uriEncode"> | Censored+stories,+1998 |
link="on" - creates a link to the story associated with the tag.
link="off" - no link is created. This is the default value for most tags.
link="email" - creates an email link. Note: this is only available on the <dpAuthor> and <dpImageArtist> tag.
link="homepage" - creates a link to a homepage. Note: this is only available on the <dpAuthor> and <dpImageArtist> tag.
Examples:
| <dpHeadline> | Dolled Up Dreck |
| <dpHeadline link="on"> | Dolled Up Dreck |
| <dpHeadline link="off"> | Dolled Up Dreck |
|
<dpQuery author="this" max="3"> <dpHeadline link="on"><br> </dpQuery> |
Dolled Up Dreck Ashes to Ashes Tucci Feely |
| <dpAuthor> | Wil Gerken |
| <dpAuthor link="email"> | Wil Gerken |
| <dpAuthor link="homepage"> | Wil Gerken |
The text that is returned by a tag is known as a "string". By default, the entire string is returned, and these attributes are not used. However, if you would like to return only a portion of the string, or manipulate the string in any way, you will need to use some or all of these attributes.
start - where to begin within the string
stop - where to end within the string
length - the length to return, most commonly used by itself or in conjunction with start.
#p - number of paragraphs. 1p = one paragraph, 2p = two paragraphs, etc.
#s - number of sentences. 1s = one sentence, 4s = four sentences, etc.
#w - number of words. 1w = one word, 5w = five words, etc.
#c - number of characters. 1c = one character, 10c = ten characters, etc.
begin - the beginning of the string
end - the end of the string
resume - continue from where you just left off. "Resume" will be equal to "begin" on the first call, and then equal to where you ended for the next call.
Examples:
Note: Spaces are counted as characters, but consecutive spaces are counted as only one character.
| <dpHeadline> | All Fired Up |
| <dpHeadline length="1w"> | All |
| <dpHeadline length="2w"> | All Fired |
| <dpHeadline length="3w"> | All Fired Up |
| <dpHeadline length="3c"> | All |
| <dpHeadline length="5c"> | All F |
Note: "Start" always begins after what you specify as the starting position, as in these examples below:
| <dpHeadline start="begin"> | All Fired Up |
| <dpHeadline start="1w"> | Fired Up |
| <dpHeadline start="2w"> | Up |
| <dpHeadline start="2c"> | l Fired Up |
| <dpHeadline start="8c"> | d Up |
Note: "Stop" specifies what position to stop at, unlike "length" which specifies how much to return.
| <dpHeadline start="4c" stop="5c"> | F |
| <dpHeadline start="5c" stop="7c"> | ir |
| <dpHeadline start="2w" stop="3w"> | Up |
Display Tags
The display tags are the Dispatch tags that specifically relate to the fields in your publication's database, be it the headline, author, story or a user defined field. They are the most common of the Dispatch tags, and are primarily used to retrieve, manipulate and display information on a page.
<dpAuthor>
D E F I N I T I O N:
The author of the story currently being built or queried. By default <dpAuthor> will always return all of the authors of the story.
<dpAuthor
format="standard|initials|fmlast|firstlast|lastfirst|first|middle|last"
number="#|all"
return="value|count"
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off|email|homepage"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
<dpAuthor format="standard"> - Kay Anne Sather
<dpAuthor format="initials"> - KAS
<dpAuthor format="fmlast"> - K A Sather
<dpAuthor format="firstlast"> - Kay Sather
<dpAuthor format="lastfirst"> - Sather, Kay
<dpAuthor format="first"> - Kay
<dpAuthor format="middle"> - Anne
<dpAuthor format="last"> - Sather
number="all" is the default and will always return all the authors of a story, be it one or many.
For example:
<dpIf <dpAuthor return="count"> = 1>
{do the regular author layout}
<dpElseIf <dpAuthor return="count"> gt 1>
{do the multi author layout and loop through the authors}
</dpIf>
The following expands on this concept and creates a link to the author's archive page. If there are multiple authors, it will create a link to each author's individual archive page by looping through them.
<dpIf <dpAuthor return="count"> = 1>
<dpAuthorCredit> <a href="../authors/<dpAuthorID>.html"><dpAuthor></a>
<dpElseIf <dpAuthor return="count"> gt 1>
<dpAuthorCredit>
<dpLoop var="i" from="1" to="<dpAuthor return="count">">
<a href="../authors/<dpAuthorID number="<dpVar i>">.html">
<dpAuthor number="<dpVar i>"></a>
<dpIf <dpVar i> lt <dpAuthor return="count">>
,
</dpIf>
</dpLoop>
</dpIf>
The idea is to loop through however many authors you have (from="1" to="<dpAuthor return="count">"), and then process each one individually, using the number attribute and the loop variable (<dpVar i>).
An additional test is performed to see if it is the last author or not. If it isn't a comma is displayed.
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpAuthor> |
Jeff Smith |
|
<dpAuthor link="email"> |
Jeff Smith |
|
<dpAuthor format="initials"> |
JS |
|
<dpIf <dpAuthor>> <i><dpAuthorCredit> <dpAuthor></i> </dpIf> |
By Jeff Smith |
Customizing Author Formatting [1/2]
<dpAuthor number="all"> is the default value for authors and will always display multiple authors in the following format:
Humpty Dumpty, Robert Crumb and Dr. Seuss
If you decide you want to customize this, you can do so by looping through the authors as follows.
T A G C O D E:
<dpLoop var="i" from="1" to="<dpAuthor return="count">">
<dpAuthor number="<dpVar i>">
<dpIf <dpVar i> = <dpMath <dpAuthor return="count">-1>>
&
<dpElseIf <dpVar i> != <dpAuthor return="count">>
,
</dpIf>
</dpLoop>
E F F E C T:
Phil Campbell, Josh Feit, Trisha Ready & Jennifer Vogel
A D D I T I O N A L I N F O R M A T I O N:
This code always displays an author. It then tests to see if it is the one before last in a multiple author scenario. If it is, it displays an "&". If it isn't, it tests to make sure it isn't the last author and displays a comma.
Customizing Author Formatting [2/2]
A more common customization would be to add a link to an author archive page. This can be achieved with the same logic as the previous example, with the addition of a link around the author's name.
T A G C O D E:
<dpLoop var="i" from="1" to="<dpAuthor return="count">">
<a href="../archives/<dpAuthorID number="<dpVar i>">.html"><dpAuthor number="<dpVar i>"></a>
<dpIf <dpVar i> = <dpMath <dpAuthor return="count">-1>>
&
<dpElseIf <dpVar i> != <dpAuthor return="count">>
,
</dpIf>
</dpLoop>
E F F E C T:
Phil Campbell, Josh Feit, Trisha Ready Jennifer Vogel
Modifying Multiple Author, Artist and UDF Output
T A G C O D E:
E F F E C T:
Testing for Multiple Authors
By default <dpAuthor> and <dpAuthorID> will always return all authors if there are multiple author. For example:
<dpAuthor>
Robert Crumb and Neil Gaiman.
If you want to have a special layout for single authors and another layout for multiple authors, you can test the author count in a condition to achieve this.
T A G C O D E:
<dpIf <dpAuthor return="count"> = 1>
# single author layout goes here
<dpElse>
# multiple author layout goes here
</dpIf>
E F F E C T:
A D D I T I O N A L I N F O R M A T I O N:
The following is an example of how you might link to individual author archive pages:
<dpIf <dpAuthor return="count"> = 1>
<dpAuthorCredit>
<a href="../authors/<dpAuthorID>.html"><dpAuthor></a>
<dpElseIf <dpAuthor return="count"> gt 1>
<dpAuthorCredit>
<dpLoop var="i" from="1" to="<dpAuthor return="count">">
<a href="../authors/<dpAuthorID number="<dpVar i>">.html"><dpAuthor
number="<dpVar i>"></a>
<dpIf <dpVar i> lt <dpAuthor return="count">>
,
</dpIf>
</dpLoop>
</dpIf>
Exploring the Author Format Attribute
The following are examples of how to use the format attribute in <dpAuthor>.
T A G C O D E:
<dpAuthor> returns: Harry Dean Stanton
<dpAuthor format="first"> would return: Harry
<dpAuthor format="middle"> would return: Dean
<dpAuthor format="last"> would return: Stanton
<dpAuthor format="last" style="upper"> would return: STANTON
E F F E C T:
Testing for Author E-mail
You can have your author names linked to their e-mail addresses by using <dpAuthor link="email">, but what if an author doesn't have an e-mail address in the database?
With the following code, you can test to see if an e-mail address exists and, if not, link to a generic e-mail account.
Note that we start by testing to see if an author exists.
T A G C O D E:
<dpIf <dpAuthor>>
<dpIf <dpAuthor link="email">!=<dpAuthor>>
<dpAuthor link="email">
<dpElse>
<a href="mailto:letters@yourpub.com"><dpAuthor></a>
</dpIf>
</dpIf>
E F F E C T:
<dpAuthorCredit>
D E F I N I T I O N:
Returns the credit type for the author, such as "By" or "Edited By".
<dpAuthorCredit
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
<dpAuthorCredit> <dpAuthor>
would return: By Neil Gaiman
A more common use would be to test to see if the story has an author first:
<dpIf <dpAuthor>>
<dpAuthorCredit> <dpAuthor>
</dpIf>
<dpAuthorID>
D E F I N I T I O N:
The author ID of the story currently being built or queried. ID's are always in lowercase and contain no spaces. They are most commonly used to reference images or files.
<dpAuthorID
default="default text"
number="#"
return="value|count"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpAuthorID> |
jeffsmith |
<dpColumn>
D E F I N I T I O N:
The column that the story belongs to which is currently being built or queried.
<dpColumn
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpColumn> |
Music Feature |
|
<dpColumn style="lower"> |
music feature |
|
You're viewing: <dpColumn> |
You're viewing: Music Feature |
<dpColumnID>
D E F I N I T I O N:
The column ID that the story belongs to which is currently being built or queried. ID's are always in lowercase and contain no spaces. They are most commonly used to reference image names or files.
<dpColumnID
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpColumnID> |
smith |
|
<dpIf <dpColumnID> = "smith"> You're reading smith! <dpElse> You should really check out <a href="smith.html">Smith</a>. </dpIf> |
You're reading smith! |
<dpFile>
D E F I N I T I O N:
The file name of the story currently being built or queried.
<dpFile
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpFile> |
smith.html |
<dpFileID>
D E F I N I T I O N:
The file ID of the story that is currently being built or queried. <dpFileID> always returns the base file name, as in "cinema" or "cinema4", whereas <dpFile> would return "cinema.html" or "cinema4.html".
<dpFileID
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpFileID> |
smith |
<dpHeadline>
D E F I N I T I O N:
The headline of the story currently being built or queried.
<dpHeadline
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpHeadline> |
All Fired Up |
|
<dpHeadline style="upper" style="spaced"> |
|
|
<b><dpHeadline link="on"></b><br> <dpSummary> |
All Fired Up The Steak-Out, home of the $30 steak with no potato, burned down a week ago last Saturday. |
Large Headline
To change the size of a Dispatch tag, use HTML tags such as header tags, fonts or style sheets.
T A G C O D E:
<font size="5"><dpHeadline></font>
E F F E C T:
Titanic Sinks! Hundreds Dead!
Color Headline
To change the appearance of a Dispatch tag, use HTML tags such as bold, italic, fonts, underlines, and style sheets.
T A G C O D E:
<font color="#3333FF"><dpHeadline></font>
E F F E C T:
Titanic Sinks! Hundreds Dead!
Upper Case Spaced Headline
Using the Dispatch style attribute, you can change the spacing of a tag for design purposes. You can also use additional styles to further adjust for your design.
Notice that two "style" attributes are used in the following example to achieve this effect.
T A G C O D E:
<dpHeadline style="upper" style="spaced">
E F F E C T:
Headline Test
If you want to test that a headline exists before displaying anything, you can use <dpIf>
T A G C O D E:
<dpIf <dpHeadline>>
<dpHeadline>
<dpElse>
Sorry no headline
</dpIf>
This can also be written in the following format. != means not equal.
<dpIf <dpHeadline> != "">
<dpHeadline>
<dpElse>
Sorry no headline
</dpIf>
E F F E C T:
If there was a headline, the following would display:
Titanic Sinks! Hundreds Dead!
Else if there wasn't a headline, the following would display:
Sorry no headline
Truncate Headline
Some designs may require that you limit the maximum length of a headline or another Dispatch tag. This can be achieved by using the "length" attribute.
The following examples limit the length of the headline by character and word.
T A G C O D E:
<dpHeadline length="20c">
<p>
<dpHeadline length="3w">...
E F F E C T:
Titanic Sinks! Hundr
Titanic Sinks! Hundreds...
Vertical Headline
The following example demonstrates how you can loop through a Dispatch tag to achieve a desired design effect.
T A G C O D E:
<tt>
<dpLoop var="i" from="1" to="<dpLength unit="c"><dpHeadline></dpLength>">
<dpHeadline start="resume" length="1c"><br>
</dpLoop>
</tt>
E F F E C T:
T
i
t
a
n
i
c
S
i
n
k
s
!
H
u
n
d
r
e
d
s
D
e
a
d
!
A D D I T I O N A L I N F O R M A T I O N:
The tag code loops through the headline one character at a time. It defines the length of the loop by determining the length of the headline (<dpLength unit="c"><dpHeadline></dpLength>").
For each iteration of the loop, the headline picks up where it left off (start="resume"), and displays one character (length="1c") followed by a line break.
Diagonal Headline
The following example demonstrates how you can loop through a Dispatch tag to achieve a desired design effect.
T A G C O D E:
<tt>
<dpLoop var="i" from="1" to="<dpLength unit="c"><dpHeadline></dpLength>">
<dpLoop var="j" from="1" to="<dpVar i>"> </dpLoop>
<dpHeadline start="resume" length="1c"><br>
</dpLoop>
</tt>
E F F E C T:
T
i
t
a
n
i
c
S
i
n
k
s
!
H
u
n
d
r
e
d
s
D
e
a
d
!
A D D I T I O N A L I N F O R M A T I O N:
The tag code loops through the headline one character at a time. It defines the length of the loop by determining the length of the headline (<dpLength unit="c"><dpHeadline></dpLength>").
For each iteration of the loop, a second loop is executed to insert spaces based on how many characters into the headline it currently is. Then the headline picks up where it left off (start="resume"), and displays one character (length="1c") followed by a line break.
<dpHeadlineDefault>
D E F I N I T I O N:
This tag will return the headline value you have set for this column's default headline.
<dpHeadlineDefault
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
<dpIssue>
D E F I N I T I O N:
The issue of the story currently being built or queried. This is also the directory name of the issue.
<dpIssue
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpIssue> |
1998-06-25 |
|
<dpIssue style="roman"> |
MCMXCVIII-VI-XXV |
<dpIssueID>
D E F I N I T I O N:
The issue ID of the story currently being built or queried. ID's are always in lowercase and contain no spaces. They are most commonly used to reference image names.
<dpIssueID
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpIssueID> |
1998-06-25 |
<dpIssueDate>
D E F I N I T I O N:
The issue date of the issue currently being built or queried.
<dpIssueDate
begin="strftime()"
separator="default text"
end="strftime()"
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
The default format for <dpIssueDate> is: <dpIssueDate begin="%B %e - " begin="%B %e, %Y">, which returns a date in this format: "June 25 - July 1, 1999"
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
strftime() values:
| Thursday | National representation of the full weekday name. | |
| Thu | National representation of the abbreviated weekday name, where the abbreviation is the first three characters. | |
| January | National representation of the full month name. | |
| Jan | National representation of the abbreviated month name, where the abbreviation is the first three characters. | |
| 01 | Month as a decimal number (01-12). | |
| 07 | Day of the month as a decimal number (01-31). | |
| 7 | Day of the month as a decimal number (1-31); single digits are preceded by a blank. | |
| 1998 | Year with century as a decimal number. | |
| 98 | Year without century as a decimal number (00-99). | |
| 01/07/98 | Equivalent to "%m/%d/%y". |
Additional strftime() values can be found here.
E X A M P L E S:
|
<dpIssueDate> |
June 25 - July 1, 1998 |
|
<dpIssueDate begin="%A" separator=" through " end="%A"> |
Thursday through Wednesday |
|
<dpIssueDate begin="%A through " end="%A"> |
Thursday through Wednesday |
|
<dpIssueDate begin="%B %e, %Y"> |
June 25, 1998 |
|
<dpIssueDate end="%B %e, %Y"> |
July 1, 1998 |
|
<dpIssueDate begin="%Y-%m-%d"> |
1998-06-25 |
|
<dpIssueDate begin="%B %e, %Y" style="upper"> |
JUNE 25, 1998 |
|
<dpIssueDate begin="%Y" style="roman"> |
MCMXCVIII |
<dpIssueNumber>
D E F I N I T I O N:
The issue number of the issue currently being built or queried.
<dpIssueNumber
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpIssueNumber> |
18 |
|
<dpIssueNumber style="roman"> |
XVIII |
|
<dpIssueNumber style="roman" style="lower"> |
xviii |
|
Volume <dpVolumeNumber> Issue <dpIssueNumber> |
Volume 15 Issue 18 |
<dpMetaDescription>
D E F I N I T I O N:
This tag will return the column's default meta description. You set this in column defaults.
<dpMetaDescription
default="default text"
style="lower|upper|title|spaced|roman|decimal|
noHtml|noHtmlStyle|identifier|scriptEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Notice that style="noHtml" is the default for this tag. This will prevent potential HTML from side effecting meta tags.
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
<meta name="description" content="<dpMetaDescription>">
or better yet, use the summary if it exists and then fall back (default=) to the meta description if no summary exists:
<meta name="description" content="<dpSummary style="noHTML" default="<dpMetaDescription>">">
<dpMetaKeywords>
D E F I N I T I O N:
This tag will return the column's default meta keywords. You set this in column defaults.
<dpMetaKeywords
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Notice that style="noHtml" is the default for this tag. This will prevent potential HTML from side effecting meta tags.
Please refer to the common attributes page for the common attribute descriptions.
<dpSection>
D E F I N I T I O N:
The name of the section currently being built or queried. For example, if the story currently being built is within a section named "Music", <dpSection> would return Music.
<dpSection
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpSection> |
Currents |
|
<tt><dpSection style="upper" style="spaced"></tt> |
|
|
<dpIf <dpSection> = "music"> You're in the music section <dpElse> You're NOT in the music section </dpIf> |
You're NOT in the music section |
<dpSectionID>
D E F I N I T I O N:
The section ID of the story currently being built or queried. ID's are always in lowercase and contain no spaces. They are most commonly used to reference image names.
<dpSectionID
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpSectionID> |
currents |
|
<img src="../images/<dpSectionID>.gif"> |
|
<dpStory>
D E F I N I T I O N:
The story currently being built or queried.
<dpStory
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
images="on|all|off|#|# to #|#,#"
imageStart="#p" (default is 0p)
imageStop="#p" (default is 3/4 way through story)
imageAlign="left|right|toggleLeft|toggleRight|center|none"
imageMacro="macro name"
>
A T T R I B U T E S:
<dpStory images="on">
<dpStory images="1, 3">
<dpStory images="2 to 4">
<dpStory images="2 to 4, 6">
<dpStory images="3 to <dpImageCount>">
right - all images align to the right.
left - all images align to the left
toggleLeft - images toggle left to right, back and forth
toggleRight - images toggle right to left, back and forth
center - centers image and follows it with a <p>
none
Examples:
<dpStory imageStart="2p" imageStop="10p">
This would put the first image after the second paragraph, and the last image after the 10th paragraph. All of the remaining images would be equidistantly dispersed within this range.<dpStory imageStop="14p">
If this story had three images, the first image would be before the first paragraph (default). The middle image would be after the 7th paragraph, and the last image would be after the 14th paragraph. If there was only one image, it would still be before the first paragraph and the imageStop attribute would be ignored.
When defining this layout, you can use any HTML you want and image tags "without" the number attribute. Dispatch will handle advancing the number values for the appropriate images. You may also use other Dispatch tags like conditional statements.
For example:
<dpMacro myImageLayout>Note: Like all macros, this macro needs to be declared before it is used, meaning it must be above whatever references it within your template.
<table border=1 align="<dpImageAlign>" width="<dpImageWidth>">
<tr>
<td>
Image Table<br>
<dpImage><br>
<i><dpImageCaption></i><br>
<font size=2><dpImageArtist></font>
</td>
</tr>
</table>
</dpMacro>
Usage would be as follows:
<dpStory images="all" imageMacro="myImageLayout">
Please refer to the common attributes page for the common attribute descriptions.
Your First Story Layout
A basic story layout. No conditional tests and nothing fancy.
T A G C O D E:
<dpHeadline>
<p>
<dpSubheadline>
<p>
By <dpAuthor>
<p>
<dpStory>
<p>
The above works fine, but doesn't take in many conditions, such as the absence of a headline, or a subheadline, or an author. What if the author credit isn't "by" but "edited by." The following enhancement satisfies these specific concerns:
<dpHeadline default="<dpColumn>">
<p>
<dpIf <dpSubheadline>>
<dpSubheadline>
<p>
</dpIf>
<dpIf <dpAuthor>>
<dpAuthorCredit> <dpAuthor>
<p>
</dpIf>
<dpStory>
<p>
And now with a little formatting and style:
<font size="6"><dpHeadline default="<dpColumn>"></font>
<p>
<dpIf <dpSubheadline>>
<font color="#333366" face="arial,helvetica"><b><dpSubheadline></b></font><br>
</dpIf>
<dpIf <dpAuthor>>
<font face="arial,helvetica" size="1"><dpAuthorCredit> <dpAuthor style="upper"></font>
<p>
</dpIf>
<dpStory images="on" imageAlign="right">
<p>
E F F E C T:
Testing the Length of Story
You can test the length of a story in order to decide whether to display additional ads or suggested links on the side. This can be easily achieved with <dpLength>.
T A G C O D E:
Set a variable that contains the length of the story in characters, so you can use this value in conditional tests throughout your template.
<dpVar characterCount="<dpLength unit="c"><dpStory></dpLength>">
Then add your tests where needed.
<dpIf <dpVar characterCount> gt 1500>
# display side ads
</dpIf>
or
<dpIf <dpVar characterCount> gt 1500>
# display side ads
<dpElseIf <dpVar characterCount> gt 2000>
# display side ads and suggested links
</dpIf>
Another example, might be testing the number of paragraphs for image placement. This is just a variation on the code above.
<dpVar paraCount="<dpLength unit="p"><dpStory></dpLength>">
<dpIf <dpVar paraCount> gt 3>
<dpC>Start Images lower on the page</dpC>
<dpStory images="on" imageStart="2p" imageAlign="right">
<dpElse>
<dpStory images="on" imageAlign="right">
</dpIf>
E F F E C T:
Dropcaps
This example shows how you can give the first character of a story a special treatment, and then display the remainder of the story.
T A G C O D E:
<table border=0 cellpadding=0 cellspacing=0 align=left>
<tr>
<td valign=top align=left>
<font size=6 face="arial,helvetica">
<dpStory start="begin" length="1c" style="noHtml">
</font>
</td>
<td valign=top align=left> </td>
</tr>
</table>
<dpStory start="resume">
E F F E C T:
| W |
So why is it that I'm finding it hard to feel that kind of love these days?
The explosion of music coverage in magazines and on the web since Michael first moonwalked and Madonna pulled on her fishnets has evolved to the point where no subject is out of bounds. And some bands are happy to play into it: What could keep fans more on edge than constant breakup rumors and in-fighting?
Pavement are the biggest offenders these days. In fact, they've been "breaking up" for the majority of their career. But last November, it looked like the end had finally come. The New Musical Express website (www.nme.com) reported a much publicized -- and disputed -- comment allegedly made by lead singer Stephen Malkmus during a performance at the London Brixton Academy. According to the website, Malkmus explained a pair of handcuffs hanging from his mic stand by saying, "These symbolize what it's like being in a band."
Matador, the band's label, stoked the fires by neither confirming nor denying the story in a brief post on their homepage.
On December 1, matters became even more confusing when NME quoted bandmember Scott Kannberg from an earlier SonicNet (www.sonicnet.com) article, where Kannberg claimed that what Malkmus had actually said about the cuffs was "This is what it's like playing in England." Kannberg was quoted by NME as saying the band was going to take a few years off, and the website called the split "official."
To make matters more confusing, the official Pavement website (www.pavementtherockband.com) put up the following disclaimer: "Contrary to what has been said, Pavement are not breaking up. They are taking a much needed rest as they do at the end of every touring year. They would like to thank all of those who have supported them this year as in the past. They will be back sooner than you know. In the meantime, Pavement will be working on The Slow Century video and DVD compilation to be released sometime in the new century."
Hey, Pavement: Break up or speak up. We're tired of trying to find reliable information about the future of your band. I run out to the record store just like everybody else on release day, happy to get your new record, but by crying wolf so often you're tainting your legacy.
Likewise, the Smashing Pumpkins are a lightning rod for breakup rumors. After the admission that Siamese Dream was pretty much the Billy and Jimmy show, it seemed alt rock had finally found a control freak to rival Dinosaur Jr.'s J. Mascis, and it wasn't until Corgan promised to let the rest of the band play on the follow-up that it appeared the group would continue... until the drama of firing Jimmy... who rejoins triumphantly... and now we have the departure of D'Arcy.
Of course, there have been some modern-day departures that left me feeling misty. Bands who knew when to say when and did it with grace. Take Portland's Heatmiser, who made the best album of their career, Mic City Sons, for Virgin/Caroline, and then promptly disappeared. Lucky for us, Elliott Smith and Sam Coomes put out even better records thereafter. And there was Seattle's own Soundgarden, who calmly called it quits in April 1997 after the modest success of Down on the Upside. True, their commercial peak was Superunknown, but they got out of the grunge game while others (Alice in Chains, Tad) were stumbling blindly toward the end.
It's best to leave us wanting more, not sick to death of you. We expect a reunion in five years anyway, now that hell froze over for the Eagles. In the opening days of 2000 we have been given a warning sign: Camper Van Beethoven, the first major indie rock reunion. Who's next? Slint?
So Pavement, Smashing Pumpkins: You guys go ahead and break up. We dare you. You'll be back.
<dpSubheadline>
D E F I N I T I O N:
The subheadline of the story currently being built or queried.
<dpSubheadline
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpSubHeadline> |
Sonoita's Locals Lose An Institution Of Sorts. |
|
<i><dpSubHeadline></i> |
Sonoita's Locals Lose An Institution Of Sorts. |
|
<dpSubHeadline style="lower"> |
sonoita's locals lose an institution of sorts. |
<dpSubheadlineDefault>
D E F I N I T I O N:
This tag will return the subheadline value you have set for this column's default subheadline.
<dpSubheadlineDefault
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
<dpSummary>
D E F I N I T I O N:
The summary of the story currently being built or queried.
<dpSummary
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpSummary> |
The Steak-Out, home of the $30 steak with no potato, burned down a week ago last Saturday. |
|
<b><dpHeadline link="on"></b><br> <dpSummary start="begin" length="9w">... |
All Fired Up The Steak-Out, home of the $30 steak with no... |
<dpSummaryDefault>
D E F I N I T I O N:
This tag will return the summary you have set for this column's default summary.
<dpSummaryDefault
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
<dpUserField>
D E F I N I T I O N:
Returns the value contained in a user defined field (UDF) or the number (count) of values in a user defined field.
<dpUserField
name="(UDFname)"
number="#|all"
return="value|count"
realm="story|column|issue|all"
squeeze="no|yes"
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
Creating E-commerce Links and Passing Arguments for External Queries
Using User Defined Fields, you can create e-commerce links for books, movies, or music reviews.
For example, if you have a User Defined Field named "book title," you can create a link to that book at Amazon.com. Find the format that Amazon.com uses for its queries. For books, the URL (at the time of writing this) is: http://www.amazon.com/exec/obidos/external-search?keyword=book+title&mode=books Add the following code to your template. It may look a bit cryptic, but it should make sense if you read through it.
T A G C O D E:
<a href="http://www.amazon.com/exec/obidos/external-search?keyword=<dpUserField name="book title" style="lower" style="nohtml" style="urlEncode">&mode=books">Search for related books at Amazon.com</a>
or
<a href="http://www.amazon.com/exec/obidos/external-search?keyword=<dpUserField name="book title" style="lower" style="nohtml" style="urlEncode">&mode=books">Purchase <dpUserField name="book title"> at Amazon.com</a>
Basically, we've replaced the keyword section, which previously had "book+title", with the following: <dpUserField name="book title" style="lower" style="nohtml" style="urlEncode">, which says take the Book Title, change it to lower case, remove any HTML it may have, and encode it so it can be passed in a URL.
Try it out and you'll see how it connects directly to the Amazon search allowing the reader to get right to the book they want. You can use this dynamic tag code to create smart links to external sites.
Here's another example using Google.com and a variable:
<dpVar encodedTitle="<dpUserField name="book title" style="lower"
style="noHtml" style="urlEncode">">
<a href="http://www.google.com/search?q=<dpVar encodedTitle>&mode=books"
target="_blank">Search Google for more on <dpUserField name="book
title"></a>
This would create a link like the following:
http://www.google.com/search?q=good+omens
E F F E C T:
Sorting By UDF
To sort by a UDF, simply add a sort value like the following to your query.
T A G C O D E:
The following will sort by film title from a to z:
<dpQuery sort="userField:film title">
The following will reverse sort by film title from z to a:
<dpQuery sort="-userField:film title">
And the following will first sort by film title, then by issue:
<dpQuery sort="userField:film title" sort="issue">
Here are a few real life examples:
<dpQuery issue="all" userField="film genre" sort="userfield:film title"
sort="fuzzy" max="4">
<dpUserField name="film title"><br>
</dpQuery>
The above query looks through "all" issues, matching any stories based on
film genres. It then sorts the output alphabetically by "film title", then
does a "fuzzy" sort for the best matches. To shorten this list for our demo, we set the max output to 4:
Apocalypse Now
Grand Illusion
Since You Went Away
Welcome to Sarajevo
Here's the same basic query with a reverse sort:
<dpQuery issue="all" userField="film genre" sort="-userfield:film title"
sort="fuzzy" max="4">
<dpUserField name="film title"><br>
</dpQuery>
Output:
Welcome to Sarajevo
Since You Went Away
Grand Illusion
Apocalypse Now
Sorting by UDFs allows you to organize your output alphabetically. It is also the ideal way to create lists of UDF values.
E F F E C T:
Debugging Queries with <dpUserField number="all">
Use the number attribute of a User Defined Field in queries to examine the output and fine tune your queries for best results.
T A G C O D E:
<dpUserField name="film genre" number="all"> will return something like the following:
romance, comedy, cult
This can be useful information when exploring suggested link matches. For example, if you want a list of up to five suggested links of other films with similar film genres as the story you are reading, use the following:
Suggested Links for <dpHeadline>:<br>
<dpQuery issue="archives" userField="film genre" sort="fuzzy" max="5">
<dpHeadline link="on"><br>
</dpQuery>
which would output something like this:
Suggested Links for Planet of the Vampires:
The Body Snatcher
The Changeling
The Exorcist
Halloween
House of Wax
That works perfectly, but provides little output to confirm how the match happened while debugging your templates. Here's a modification using
<dpUserField number="all"> to provide better output while testing:
Suggested Links for <dpHeadline> (<dpUserField name="film genre" number="all">)<br>
<dpQuery issue="archives" userField="film genre" sort="fuzzy" max="5">
<dpHeadline link="on"> (<dpUserField name="film genre" number="all">)<br>
</dpQuery>
which would output something like this:
Suggested Links for Planet of the Vampires (Classic, Horror)
The Body Snatcher (Classic, Horror)
The Changeling (Horror)
The Exorcist (Horror)
Halloween (Horror)
House of Wax (Horror)
E F F E C T:
Retrieving UDF Values
The following syntax demonstrates options for retrieving and manipulate the values associated with a User Defined Field:
T A G C O D E:
<dpUserField name="film genre"> - comedy
<dpUserField name="film genre" number="all"> - comedy, drama, romance
<dpUserField name="film genre" number="1"> - comedy
<dpUserField name="film genre" number="2"> - drama
<dpUserField name="film genre" number="3"> - romance
<dpUserField name="film genre" return="count"> - 3
<dpUserField name="film genre" number="all" style="upper"> - COMEDY, DRAMA, ROMANCE
E F F E C T:
Customizing UDF Display
The following macro shows how to control the display of User Defined Field values which contain multiple entries:
T A G C O D E:
Here are a few examples of the values from a User Defined Field of "film genre":
comedy, horror, sci-fi
comedy, horror and sci-fi
comedy and horror and sci-fi
comedy - horror - sci-fi
Change the separators within the macro below to get the different results shown above.
<dpMacro myUserFieldStyle>
<dpVar totalValues="<dpUserField name="<dpVar fieldName>" return="count">">
<dpLoop var="i" from="1" to="<dpVar totalValues>">
<dpIf <dpVar i> = <dpVar totalValues>>
<dpUserField name="<dpVar fieldName>" number="<dpVar i>">
<dpElseIf <dpVar i> = <dpMath <dpVar totalValues>-1>>
<dpUserField name="<dpVar fieldName>" number="<dpVar i>"> and
<dpElse>
<dpUserField name="<dpVar fieldName>" number="<dpVar i>">,
</dpIf>
</dpLoop>
</dpMacro>
To call this macro, use the following tag code:
<dpVar fieldName="film stars">
<dpMacro myUserFieldStyle>
This sets the variable fieldName to "film stars" so the macro knows what UDF to manipulate.
This logic can also be used for other User Defined Fields with values containing multiple entries, such as author and artist names.
E F F E C T:
<dpVolumeNumber>
D E F I N I T I O N:
The volume number of the issue currently being built or queried.
<dpVolumeNumber
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpVolumeNumber> |
15 |
|
<dpVolumeNumber style="roman"> |
XV |
|
Volume <dpVolumeNumber style="roman"> Issue <dpIssueNumber style="roman"> |
Volume XV Issue XVIII |
Flow Control
Flow control tags relate to conditional statements, and looping constructs. The most common use of a flow control tag is a <dpIf> statement. Using <dpIf> you can perform tests within your template to decide how you want your page to render. For example, testing the character count of a story to decide how to present the images, ads, suggested links, or even if you want to split the story into multiple pages.
<dpIf>
D E F I N I T I O N:
Conditional tests allow you to make comparisons within your templates. For example, you can calculate how many characters are in a story, and provide a special layout for each circumstance.
Simple Condition Syntax
<dpIf (comparison statement)>
action
</dpIf>
Complete Condition Syntax
<dpIf (comparison statement)>
action
<dpElseIf (comparison statement)>
action
<dpElse>
action
</dpIf>
C O M P A R I S O N O P E R A T O R S:
| = | equal |
| != | not equal |
| in | is in set |
| not | not in set |
| gt | greater than |
| lt | less than |
E X A M P L E S:
The following can be read as "If the section for this story is music, then display the message You're in the music section":
<dpIf <dpSection>="music">
You're in the music section
</dpIf>
The following can be read as "If the section for this story is music, then display the message You're in the music section, else (otherwise) display You're not in the music section":
<dpIf <dpSection>="music">
You're in the music section
<dpElse>
You're not in the music section
</dpIf>
The following can be read as "If the section for this story is music, then display the message 'You're in the music section', else if the section for this story is film, then display the message 'You're in the film section', else (otherwise) display 'You're not in the music or film section' ."
<dpIf <dpSection>="music">
You're in the music section
<dpElseIf <dpSection>="film">
You're in the film section
<dpElse>
You're not in the music or film section
</dpIf>
The following can be read as "If you're not in the film section, display the message Go to the film section":
<dpIf <dpSection> != "film">
Go to the film section.
</dpIf>
<dpLoop>
D E F I N I T I O N:
Looping is most commonly used to step through a story, headline or other display tag by paragraph or font. However you can use it for whatever you want.
<dpLoop var="variable" from="#" to="#" step="#|-#">
Instructions to repeat.
</dpLoop>
A T T R I B U T E S:
E X A M P L E S:
<dpLoop var="i" from="1" to="10">
<dpVar i>
</dpLoop>
would create: 1 2 3 4 5 6 7 8 9 10
<dpLoop var="i" from="2" to="10" step=2>
<dpVar i>
</dpLoop>
would create: 2 4 6 8 10
<dpLoop var="x" from="1" to="<dpImageCount>">
<dpImage number="<dpVar x>">
</dpLoop>
would list all of the images in the story
<dpLoop var="x" from="1" to="<dpLength unit="p"><dpStory></dpLength>">
Paragraph #<dpVar x><p>
<dpStory start="resume" length="<dpVar x>p"><p>
</dpLoop>
would loop through the story one paragraph at a time from the first paragraph to the last paragraph. It would display the paragraph number followed by the paragraph itself.
Random Case
Well, it's not exactly random, but it achieves the same visual effect. The following example loops through a story seven characters at a time, displaying them in assorted case. The primary intention of this example is to demonstrate some of the design possibilities possible by processing a story on a character by character level using length and resume.
T A G C O D E:
<dpVar charCount="<dpLength unit="c"><dpStory></dpLength>">
<dpLoop var="i" from="0" to="<dpVar charCount>" step="7">
<dpStory start="resume" length="1c" style="lower">
<dpStory start="resume" length="1c" style="upper">
<dpStory start="resume" length="1c" style="lower">
<dpStory start="resume" length="1c" style="lower">
<dpStory start="resume" length="1c">
<dpStory start="resume" length="1c">
<dpStory start="resume" length="1c" style="upper">
</dpLoop>
E F F E C T:
iN foURTeEn-HUNdRed-aNd-nineTy-two, CoLumbuS sAiled ThE oceaN bLue...oR so we'vE been LeD to beLiEve. ANd When hE rAn out Of Ocean BlUe he bUmPed up AgAinst ThE beacH sOmewhErE in thE wEst InDiEs.
CoLuMbus, An Eye-tAlIan, wAs RunniNg A smalLiSh scoUtIng exPeDitioN fOr the SpAniarDs, whosE qUeen hE'D talkEd Into fRoNting HiM threE rUnty sHiPs for ThE purpOsE of fiNdIng a sHoRtcut To India, wHere tHeY had lOtS of siLk And teA aNd spiCeS the fOlKs bacK oN the IBeRian PEnInsulA hAd a haNkEring FoR. wheN tHe shiP hIt the SaNd out In The CaRiBbean 506 yearS aGo, ChRiS declArEd he'D fOund INdIa and NaMed thE rUddy-CoMplecTeD surfErS who gReEted hIs Boats "iNdianS."
he waS wRong eVeRy way ImAginaBlE.
so tO aPpropRiAtely HoNor CoLuMbus' BlUnder, wE here In AmeriCa (nameD fOr anoThEr itaLiAn, AmErIgo VeSpUcci, WhO also PuT in ceRtAin clAiMs for DiScoveRiNg majOr Parts Of The neW wOrld) MaNufacTuRed a cReAtion-mYth thAt Holds SaCred tHe NotioN--taugHt Like a GrImm's FaIry taLe To eveRy KindeRgArtneR--that ChRistoPhEr colUmBus diScOvereD aMericA iN 1492. nEver mInD that He BeachEd On a smAlL islaNd SouthEaSt of CUbA and nEvEr camE nEar thE nOrth AMeRican MaInlanD; Never MiNd thaT hE thouGhT he waS iN indiA; Never MiNd thaT lEif ErIkSen haD bEen heRe CentuRiEs earLiEr; neVeR mind AlL mannEr Of incOnTroveRtIble fAcT: colUmBus diScOvereD aMericA.
How coMeS it, tHeN, thaT iN 1988 ThE voteRs Of ariZoNa, thE lAst of ThE contIgUous 48 tO attaIn StateHoOd, paSsEd a coNsTitutIoNal amEnDment MaKing ENgLish tHe OfficIaL langUaGe, anD rEquirInG that AlL statE bUsineSs Be conDuCted iN eNglisH aNd engLiSh onlY?
Why noT iTaliaN, Since We've prOpAgateD tHe notIoN that An ItaliAn DiscoVeRed thIs Place? oR how aBoUt spaNiSh, CaStIlliaN-Style, oF courSe, sincE tHey puT uP the cAsH for tHe VoyagE oF discOvEry? BUt If you ReAlly tHiNk the FiRst whItE man tO pLant hIs Flag oUgHt to gEt Dibs oN tHe lanGuAge thInG, why NoT norwEgIan?
THeN agaiN, Hows aBoUt indIaN? oh mY gOodneSs Yes: pAsS the cHuTney. Or Do you MeAn red InDian? Or Do you SpEak wiTh ForkeD tOngue?
tHe poiNt Is, thAt Half tHe LanguAgEs on tHe PlaneT hAve leGiTimatE cLaims To CurreNcY in AmErIca's HiStory, iTs preSeNt and ItS futuRe. the FReNch owNeD most Of This pLaCe for A tIme; tHe Dutch HaD a pieCe Of the AcTion, AlOng wiTh PortuGuEse, AFrIcans, mExicaNs, a whoLe Array Of DiffeReNt triBaL peopLeS from AlEuts tO aThabaScAns to InCas, MAyAns, AZtEcs...yOur boYs Named SiOux, yOuR algoNqUins, ApAches...and tHeN therE wEre RuSsIans, ChInese, cAnadiAnS.
if tHeRe's oNe Thing An AmeriCaN is, iT'S a monGrEl. AnD iF therE'S
one tHiNg the
De Facto NaTive tOnGue of ThIs natIoN is, iT'S amerIcAn, noT tHe
queEn's engLiSh, thOuGh its LiNguisTiC lineAgE is moRe Or lesS
dEscenDeD from ThE writTeN langUaGe of tHe BritiSh Isles.
aMericAn Is a poLyGlot pAtOis thAt BorroWs HeaviLy--one MiGht saY sTeals UnConscIoNably--From eVeRy othEr LanguAgE on thE pLanet, aNd conSeQuentLy Is the MoSt ricH aNd widElY variEd And exPrEssivE hUman tOnGue exTaNt. We'vE got a VoCabulArY seveRaL timeS gReateR tHan thE rOmancE lAnguaGeS, let AlOne thE tRibal ToNgues Of The seCoNd- anD tHird-WoRlds, AnD oldeR lAnguaGeS are oNlY now bEgInninG tO broaDeN theiR tHesauRi By borRoWing bAcK pidgEn-amerIcAn terMs We've AlReady RiPped oFf From tHeM.
ameRiCan laNgUage iS a Bawdy, bRawliNg SteroId-monsTeR of a gRoWing cHiLd thaT dRaws iTs Very vIgOr froM iTs proXiMity tO tHat stOrIed meLtIng poT oF otheR cUlturEs And laNgUages--All of WhIch coMe Here aNd Give.
So I ask aGaIn: WhAt's up wItH the ENgLish-OnLy thiNg? most Of Us couLdN't spEaK real EnGlish If We wanTeD to. I ReNted THe Full MOnTy for JoNes anD hIs wifE uP in FlAgStaff A cOuple WeEks agO, And MrS. Jones DiDn't eNjOy it aT aLl. ShE cOuld oNlY make OuT abouT oNe worD iN threE. They wErE speaKiNg worKiNg-clAsS englIsH. try A sImilaR eThnic FlIck, sUbTitleD iN, say, sOuthsIdE chicAgO dialEcT, and YoUr audIeNce in ShEffieLd, englAnD, wouLd Be simIlArly aT sEa.
BuT aSide fRoM the iNhErent InAccurAcY in caLlIng ArIzOna's RaCist lItTle biT oF initIaTive aNd ReferEnDum EnGlIsh-oNlY vs. AMeRican-oNly, tHeRe's tHaT wholE dEal wiTh The U.S. ConstItUtion AnD the FIrSt ameNdMent tHeReto. NoWhere In The foUnDing dOcUmentS oF this NaTion'S gOvernMeNt is tHeRe any ReFerenCe To an oFfIcial LaNguagE. Nor coUlDa, shOuLda, wOuLda beEn.
the fIrSt freEdOm the FrAmers ObServeD iN the BIlL of RiGhTs was ThE freeDoM of spEeCh, anD tHerefOr, of thE pRess, AnD by loGiCal exTeNsion, oF reliGiOn, faItH, of aSsEmbly. iT takeS nO more SoPhistIcAted lEgAl schOlAr thaN yOur tyPiCal 5-YeAr-olD tO recoGnIze thAt If govErNment DeClareS eNglisH tO be thE oNly laWfUl and OfFiciaL lAnguaGe Of our SoCiety, aNd thuS tHat goVeRnmenT bUsineSs CannoT bE tranSaCted iN sPanisH, LatviAn, urdu Or Latin, tHen thE fIrst AMeNdmenT iS meanInGless To AmeriCaNs who HaPpen tO sPeak oNe Of thoSe InsteAd Of engLiSh.
I sAiD as muCh A decaDe Ago, aNd PrediCtEd a shOrT life FoR the ENgLish-OnLy ameNdMent. As Is so oFtEn the CaSe, noT oNly waS i Right, i Was waY aHead oF mY time.
iT took 10 Years FoR the ARiZona SUpReme COuRt to iSsUe a quItE simpLe, quitE cOmmonSeNsicaL oPinioN aGainsT tHe conStItutiOnAlity Of The EnGlIsh-oNlY law. AnD at thAt, the oPiNion wAs AnnouNcEd a yeAr After ThE retiReMent oF tHe jusTiCe who WrOte thE mAjoriTy OpiniOn.
and nOw The caSe Must cErTainlY gO to thE u.s. SuPrEme CoUrT, whiCh Has a rEcEnt hiStOry of CoWardiCe In facInG such OuTwardLy SimplE aNd uncOnTroveRsIal caSeS.
hey! wE know AmEricaN eNglisH iS for aLl PractIcAl purPoSes thE lAnguaGe Of u.S. gOvernMeNt, coMmErce aNd Daily LiFe: We DoN't neEd Some xEnOphobIc, raciSt Law on ThE bookS tO make It OfficIaL, and To Force NoN-engLiSh speAkErs fuRtHer ouTsIde thE mAinstReAm.
DoWn Here iN sOutheRn ArizoNa, wherE mUch of ThE locaL cOmmerCe Still GoEs on iN bOrder SpAnish, tHe rulInG grinGo Class LiKes to LoOk dowN iTs patRiCian nOsE at thOsE ignoRaNt, laZy MexicAnS whosE eNglisH iSn't uP tO harvArD stanDaRds. NEvEr minD tHat moSt Of theSe White BoYs can't PronoUnCe "taMaLes" oR uNdersTaNd wheN tHe waiTrEss smIlEs and CaLls thEm "cabrOnEs."
IT'S kind Of Like FReD astaIrE and GInGer RoGeRs--FReD beinG tHe whiTe Boy anD gInger ThE mexiCaN. fed To The tiTs With hEaRing AStAire lIoNized FoR his tErPsichOrEan skIlLs, GiNgEr oncE rEmarkEd, archLy, "honEy, i did EvEry daNcE step FrEd eveR dId...BaCkwarDs, and iN hIgh heElS."
CoMpRende?
Horizontal Paragraphs
A fun example that demonstrates using loop and length to achieve a desired effect.
T A G C O D E:
<table border=0 cellpadding=10 cellspacing=0>
<tr>
<dpVar paraCount="<dpLength unit="p"><dpStory></dpLength>">
<dpLoop var="i" from="0" to="<dpVar paraCount>">
<td valign=middle align=left width=250>
<dpStory start="resume" length="1p"><br>
<img src="../images/spacer.gif" width=250 height=1 alt=""><br>
</td>
</dpLoop>
</tr>
</table>
E F F E C T:
|
TUBA CITY--UP until now I never gave a thought to how this
place came to be called what we call it. The first time I came
through here must have been 25 years ago, and it sounded appropriately
colorful and colloquial and Stephen Vincent Benet. You know, "...Tombstone
and Tucson and Mexican Hat." So I concentrated on finding
a gas station and a Coke machine and thought ahead to Flagstaff.
|
Today I've got time to kill, so I'm parked outside a McDonald's
eating an Egg McMuffin and realizing for the first time that there
must have been a tuba in Tuba City's past.
|
What the Navajos called the place before the white men brought
their musical instruments and their language to the rez I have
no idea. This place might not even have been a place, as far as
the aborigines were concerned. Maybe Tuba City is only here because
of white capitalism.
|
There's an ancient trading post here. And where white capitalism
went, the army and the Indian Bureau followed, to protect the
dollar and eventually, fruitlessly, to missionize the heathen.
|
The town's core clearly is G.I.
|
Stone buildings of the Victorian period and style testify to
mid-19th-century failure to impose WASPish civilization and sensibility
on desert semi-nomads. The rock houses and offices of early government
settlement stand empty and idle today. Today they still are the
best real estate in town and yet the wind and not much else blows
through them, an ironic commentary on wasted time and dubious
intentions. A continuing waste of resource. Down the street toward
the highway that crosses the rez, a jumble of trailers sits behind
a billboard that proclaims, "All People Housing."
|
Populism comes at a price and part of that is living in recycled
beer cans.
|
Across the road from All People Housing, three-quarter-ton pickups
with gooseneck trailers are parked on a sandlot, peddling alfalfa
hay for $7 a bale. As a man whose personal hay requirements approach
two tons per annum, I'm interested both in the quality and price
of the product. It looks to be good, third-cutting hay, 100-plus
pounds to the bale, and cheaper than I can usually buy it in Patagonia
or Sonoita. I pull up alongside a Navajo sitting in the back of
a stock trailer and ask where it's from.
|
"St. George," he says. He knows I know that he doesn't
need to explain that there's not much in the way of commercial
hay production on the reservation. A tourist from New Jersey could
tell you as much. Navajo rugs and blankets aren't the only reason
the rez is sheep country. Arid doesn't begin to describe the climate
and terrain. Anyway, they import horse hay from Utah, and according
to my Native American informant, the Mormon farmers from St. George
exact a considerable tariff on agricultural products crossing
the border onto the rez.
|
By now I have a far deeper appreciation of Tuba City than the
previous quarter-century had given me. A little curiosity and
a single question can earn a man a lot out here.
|
Back on Highway 160 I picture the road ahead: Monument Valley
and the left-hander at Teec Nos Pos, Four Corners and Cortez,
Colorado, and then how far and how long to Hotchkiss beyond? Then
it dawns on me that it doesn't matter. I remember the last time
I drove this road; two years ago, heading west, from the same
house in Hotchkiss that is my destination today. That time my
destination was today's point of origination. Morse to Jones then:
Jones to Morse now. Then, I stopped for gas and Gatorade at Kayenta
in the middle of a monsoon. Then I was on my motorcycle, soaked
to the hide, burnt to a frito from wind and intermittent sun,
aching like a stubbed toe and wishing my ride were over. I asked
a young Navajo man coming out of the Circle K if he could tell
me how far it was to Flagstaff.
|
"Yes," he said. "Maybe about 110 miles. Maybe
300." He struck off walking in that direction. If it was
information enough for him, on foot, it surely was sufficient
unto my needs, with a hundred horsepower under my ass.
|
I was going to wind up at Jones' house in Flagstaff before I
shut it down for the day: I was going to get cold leftovers, a
hot bath and a pallet on the floor no matter what hour I arrived.
These issues had been decided by or for me before I embarked,
perhaps before I was born. So what I sought from the Indian shuffling
down the side of the highway was superfluous information. It didn't
matter whether Flagstaff was 110 miles and an hour away, or 300
miles and 15 hours distant. He understood that; what was my problem?
|
"You'll be there when you get there," I told myself,
and turned off the radio. I thought of Chuck Bowden, the gawky
guy I went to high school with, who became an amateur newspaper
reporter and then a famous professional writer of trenchant social
commentary in glossy national magazines. Not to mention books.
I asked Chuck one time what he found so attractive about the ground
between Yuma and Gila Bend.
|
"There's less to see there," he said. Deliberately
Papago-sounding, I thought at the time.
|
Well I wanted to see and hear less too. Less FM radio and air-conditioning
and the interior of a Dakota pickup, so I shut off the tunes and
the air and opened the windows and gawked around at the sandstone
and sagebrush and Maynard Dixon clouds in the blue blue sky.
|
Before long this minimalist sensory environment concentrated
itself on the bridge of my nose where the pads of my sunglasses
seemed to me to be restricting my breathing. A stream-of-consciousness
ran through my torpid thought-processes something like this:
|
Pinched nostrils...pince nez...Nez Perce...from where the sun
now stands I will fight no more forever.
|
Fortunately for everyone, not the least of whom would be you,
the reader, the archetypal reservation vignette suddenly appeared
before me.
|
A pickup truck pulled onto the highway a ways up the road. Far
enough that I didn't run up on their bumper, but not so far I
didn't have to brake and slow to follow them. Two young Navajos,
a boy and a girl, teens or early 20s, sat in the back, staring
at me staring back at them. Perfect.
|
I heard some stand-up comic on TV one time say that the hardest
thing in the world was to look cool riding in the back of a pickup.
I laughed then because I'd done my share of riding in the back
of a pickup. I smiled now because these two Navajo kids didn't
seem uncomfortable or uncool in the least.
|
I tailed them for 10 or 15 miles, and it occurred to me that
some of the differences that white boys like me perceive between,
well, white boys like me and Indians like them could be founded
in, found in, these pickup trucks and the contrasting views they
afford of the world around us. Here I sit, hand on the wheel,
foot on the gas, rushing to meet a world that hurries toward me
through the glass of my windshield.
|
And there sit the heirs of the Navajo nation: bare-headed under
the summer sun, whipped by an unceasing wind, their backs to the
momentum of an iron horse that hurls them toward an unseen destination...the
world they know receding into the infinite behind them.
|
I think I better stop and take a leak.
|
By now I have a far deeper appreciation of Tuba City than the
previous quarter-century had given me. A little curiosity and
a single question can earn a man a lot out here.
|
The Wave
The wave demonstrates one way of using <dpLoop>, <dpVar>, length and <dpIf> to achieve about any design effect imaginable.
T A G C O D E:
<dpVar direction="decrement">
<dpVar fontSize="7">
<dpVar charCount="<dpLength unit="c"><dpStory></dpLength>">
<dpLoop var="i" from="0" to="<dpVar charCount>">
<dpIf <dpVar direction>="decrement">
<dpVar fontSize="<dpMath <dpVar fontSize> - 1>">
<dpIf <dpVar fontSize> = 1>
<dpVar direction="increment">
</dpIf>
<dpElse>
<dpVar fontSize="<dpMath <dpVar fontSize> + 1>">
<dpIf <dpVar fontSize> = 6>
<dpVar direction="decrement">
</dpIf>
</dpIf>
<font size="<dpVar fontSize>"><dpStory start="resume" length="1c"></font>
</dpLoop>
E F F E C T:
T
U
B
A
C
I
T
Y
-
-
U
P
u
n
t
i
l
n
o
w
I
n
e
v
e
r
g
a
v
e
a
t
h
o
u
g
h
t
t
o
h
o
w
t
h
i
s
p
l
a
c
e
c
a
m
e
t
o
b
e
c
a
l
l
e
d
w
h
a
t
w
e
c
a
l
l
i
t
.
T
h
e
f
i
r
s
t
t
i
m
e
I
c
a
m
e
t
h
r
o
u
g
h
h
e
r
e
m
u
s
t
h
a
v
e
b
e
e
n
2
5
y
e
a
r
s
a
g
o
,
a
n
d
i
t
s
o
u
n
d
e
d
a
p
p
r
o
p
r
i
a
t
e
l
y
c
o
l
o
r
f
u
l
a
n
d
c
o
l
l
o
q
u
i
a
l
a
n
d
S
t
e
p
h
e
n
V
i
n
c
e
n
t
B
e
n
e
t
.
Y
o
u
k
n
o
w
,
"
.
.
.
T
o
m
b
s
t
o
n
e
a
n
d
T
u
c
s
o
n
a
n
d
M
e
x
i
c
a
n
H
a
t
.
"
S
o
I
c
o
n
c
e
n
t
r
a
t
e
d
o
n
f
i
n
d
i
n
g
a
g
a
s
s
t
a
t
i
o
n
a
n
d
a
C
o
k
e
m
a
c
h
i
n
e
a
n
d
t
h
o
u
g
h
t
a
h
e
a
d
t
o
F
l
a
g
s
t
a
f
f
.
T
W
...
Toggling Paragraphs
This example shows how you can use loop to toggle paragraphs left and right to break up the reading a bit.
T A G C O D E:
<center>
<dpVar paraCount="<dpLength unit="p"><dpStory></dpLength>">
<dpVar side="left">
<dpLoop var="i" from="1" to="<dpVar paraCount>">
<table border=0 width=80% cellpadding=0 cellspacing=0>
<tr>
<dpIf <dpVar side>="left">
<td valign=top align=left width=100%><dpStory start="resume" length="1p"></td>
<td valign=top align=left width=150><img src="../images/spacer.gif" width=150 height=1 alt=""></td>
<dpVar side="right">
<dpElse>
<td valign=top align=left width=150><img src="../images/spacer.gif" width=150 height=1 alt=""></td>
<td valign=top align=left width=100%><dpStory start="resume" length="1p"></td>
<dpVar side="left">
</dpIf>
</tr>
</table>
<p>
</dpLoop>
</center>
E F F E C T:
| STOP LOOKING AT ME like I'm stupid -- cuz I'm NOT. Oh, I see how you look at me when you think I'm not looking. You smile and nod at all my ass and monkey jokes, and then, as soon as I turn away? BAM! Your eyes rocket up to the top of your skull and take two swift orbits around your sockets before plummeting back to normal. Then, lips curling into that familiar, all-knowing sneer, you whisper underneath your breath, "Hoooo-boy! Wm. Steven Humphrey sure is stoo-ooh-ooh-PID!" |
| Well, LOOK! I'm not the one who's stupid, it's my TV column that's stupid. If I had MY way, I'd be writing a column about some very intelligent subject... like... oh, I don't know... like art, or politics... you know, stuff like those four-eyed sissies over at Salon write (except I certainly wouldn't name my magazine Salon! HA! What a bunch of Nancys!! HA! HA! HAAAA!). Anyway, if you ever read the other TV columnists in town (and I know for a fact you don't), they are always doing things to make themselves look smart. See, they can be talking about Moesha or Green Acres, and figure out some way to stick in the word "recalcitrant" (which means "refusing to obey") or "ignominious" (which means the same as "ignorant" but spelled differently). But don't be fooled! These people are in fact, very STUPID, and it would be ignominiously recalcitrant of me to state otherwise! |
| SO! In an effort to stop your incessant eye-rolling and palm-sniggering, I've decided to smarten up my column this week by talking about a TV channel which is nothing if not brainy: the Bravo network. In Bravo, we find a channel that is so intelligent, so cultured, it would make any of those poofs over at Salon wet their lacy petticoats. Though touted as "a film and arts network," it wisely stays away from what I like to call "the idiot arts" -- which includes opera, modern dance, and poetry -- and sticks with less snooty subjects, like independent film, interviews, and profiles, as well as the more intelligent variety of TV show (not Moesha or Green Acres). |
| For example, if you are an independent film aficionado (i.e. someone who doesn't mind watching a three-hour movie about water dripping into a bucket), Bravo often spotlights fancy-pants directors such as Kurosawa and Fellini, as well as modern-day hacks Spike Lee and John Waters. Music lovers will appreciate in-depth profiles of David Bowie, Isaac "Hot Buttered Soul" Hayes, and the Blue Note record label (Note to famous jazz artists: getting drunk and "just winging it" is not an acceptable substitute for saxophone lessons). And fans of pompous celebs should really love Inside the Actors Studio, in which laughably untalented actors like Martin Short, Sly Stallone, and Kim Basinger pontificate on the vagaries of the stage in front of an audience of drooling thespians/ future waiters. |
| However! What you should definitely not miss is Louis Theroux's Wild Weekends (in which the son of novelist Paul Theroux travels around interviewing UFO abductees, demolition derby drivers, and porn stars) and reruns of the '80s TV classic Moonlighting, which (believe it or don't) makes one fall in love with Bruce Willis all over again. Waitasecond!! I saw you roll your eyes! Goddammit, I AM NOT STUPID!! |
Image Tags
The image tags allow you to get to access all the given information on a particular image or series of images. They are most commonly used to define an image macro, but can also be used independently for precision image placement and manipulation. For more information on image macros, see <dpStory>.
<dpImage>
D E F I N I T I O N:
Returns <img src="file.gif" width="100" height="220" alt="alt value">. In addition, you can push through any other values you want. The image tag will ignore everything but the number attribute and will just send your extras along.
<dpImage
number="#"
>
E X A M P L E S:
<dpImage number="#" align="right">
returns
<img src="file.gif" width="100" height="220" alt="alt value" align="right">
<dpImage number="#" align="left" onmouseover="doSomething()">
returns
<img src="file.gif" width="100" height="220" alt="alt value" align="left" onmouseover="doSomething()">
You can also override values as follows:
<dpImage number="#" width="5">
returns <img src="file.gif" width="5" height="220" alt="alt value">
Testing Image Sizes for Layout
If you want to have wide images centered and other images aligned on the right, you can do this with an image macro. The following macro tests to see if the image width is greater than 350 pixels. If it is, it uses a centering layout. If it isn't that wide, the macro aligns the image on the right.
T A G C O D E:
<dpMacro myImageLayout>
<dpIf <dpImageWidth> gt 350>
<p>
<center>
<dpImage>
</center>
<p>
<dpElse>
<dpImage align="right">
</dpIf>
</dpMacro>
<dpStory images="on" imageMacro="myImageLayout">
E F F E C T:
Passing JavaScript or other Attributes on to Images
You may pass an "onMouseOver" event or a "vspace" on to an image associated with a story.
T A G C O D E:
You can do this longhand:
<img src="<dpImageURL>" width="<dpImageWidth>" height="<dpImageHeight>" alt="<dpImageAlt>" onMouseOver="do something" vspace="10">
or you can do it shorthand:
<dpImage onMouseOver="do something" vspace="10">
Both examples produce identical results. <dpImage> provides a shorthand that always fills out the width, height, and alt attributes as well as creating an image tag. You can pass other values on to it or override existing values by adding attributes to the tag.
Here's an example of forcing the alt of all images to display the caption.
<dpImage alt="<dpImageCaption>">
E F F E C T:
<dpImageAlt>
D E F I N I T I O N:
Returns the alt value of the specified image.
<dpImageAlt
number="#"
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
<dpImageArtist>
D E F I N I T I O N:
Returns the artist of a specific image referenced by the number. For example, if a story had three images, you would reference the second image's artist as follows: <dpImageArtist number="2">.
<dpImageArtist
default="default text"
number="#|all"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
<dpImageCaption>
D E F I N I T I O N:
Returns the caption of a specific image referenced by the number. For example, if a story had three images, you would reference the second image's caption as follows: <dpImageCaption number="2">.
<dpImageCaption
number="#"
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
<dpImageCount>
D E F I N I T I O N:
Returns the number of images the story has associated with it. For example, if a story had three images, <dpImageCount> would return "3".
<dpImageCount
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
<dpImageCredit>
D E F I N I T I O N:
Returns the credit type of the artist, for the specific image referenced by the number. Example return values include "Photo by" and "Illustration by".
<dpImageCredit
number="#"
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
<dpImageHeight>
D E F I N I T I O N:
Returns the height of the specified image.
<dpImageHeight
number="#"
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
<dpImageID>
D E F I N I T I O N:
Returns the base file name of the image. No suffix.
<dpImageID
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
<dpImageURL> returns feature1-2.gif
<dpImageID> returns feature1-2
<dpImageNumber>
D E F I N I T I O N:
Returns the number of the "current" image. This would most commonly be used in an image macro to test for a specific image. For example, if it was the first image you may want to do something specific, or the last image.
<dpImageNumber
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
<dpIf <dpImageNumber> = 1>
tests if it is the first image
special treatment for the first image
<dpElseIf <dpImageNumber> = <dpImageCount>>
tests if it is the last image
special treatment for the last image
<dpElse>
default treatment (not the first or last image)
</dpIf>
<dpImageURL>
D E F I N I T I O N:
Returns the URL of the specified image. For example <dpImageURL number="1"> would return "feature2-1.gif".
<dpImageURL
number="#"
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
<dpImageWidth>
D E F I N I T I O N:
Returns the width of the specified image.
<dpImageWidth
number="#"
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
Miscellaneous Tags
The miscellaneous tags consist primarily of functions, like <dpLength> which calculates the length of a tag value or string by character, word, sentence or paragraph. Other miscellaneous tags include <dpMath> which allows you to perform mathematical operations, and <dpSpawn> which allows a template to create other pages within your site, most commonly used for server side includes or micro sites, like author archive pages.
<dpArray>
D E F I N I T I O N:
<dpArray> allows you to sort and display values you set in an array using <dpArrayElement>. It is most commonly used to display unique and sorted lists of authors in your database.
<dpArray
name="arrayName"
sort="ascending|descending|asc|desc"
number="all|#"
return="value|count"
>
A T T R I B U T E S:
E X A M P L E S:
<dpArray name="myList" sort="ascending">
myList has <dpArray name="myList" return="count"> values.
<dpLoop var="i" from="1" to="<dpArray name="myList" return="count">">
<dpArray name="myList" number="<dpVar i>" sort="ascending">
</dpLoop>
D E T A I L S:
Defining and Using an <dpArray>
The following will define an array named "myList". It will then load two values into the array. Notice that the values require a key which is used for sorting, and a value which is used when you display the array.
T A G C O D E:
<dpArrayElement name="myList" key="gerken, wil">
Wil Gerken<br>
</dpArrayElement>
<dpArrayElement name="myList" key="forbes, collin">
Collin Forbes<br>
</dpArrayElement>
The following will sort the values in the "myList" array and display them all.
<dpArray name="myList" sort="ascending" number="all">
which will return:
Collin Forbes<br>
Wil Gerken<br>
Give it a try in the tag tester.
E F F E C T:
Creating an Author List
The following produces a two column layout of unique authors sorted alphabetically. To add links to the author archive page, modify the array element to include the desired link. For instance:
<a href="../authors/<dpAuthorID number="<dpVar i>">"><dpAuthor number="<dpVar i>"></a><br>
T A G C O D E:
<dpQuery issue="all" realm="author">
<dpLoop var="i" from="1" to="<dpAuthor return="count">">
<dpArrayElement name="myList" key="<dpAuthor number="<dpVar i>"
format="lastfirst">">
<dpAuthor number="<dpVar i>"><br>
</dpArrayElement>
</dpLoop>
</dpQuery>
<dpComment>
Set middle marker and offset by one if uneven so left side gets extra length.
</dpComment>
<dpVar top="<dpArray name="myList" return="count">">
<dpVar middle="<dpMath <dpVar top>/2>">
<dpIf <dpMath <dpVar top>%<dpVar middle>> != 0>
<dpVar middle="<dpMath <dpVar middle>+1>">
</dpIf>
<dpComment>
Render dual column table
</dpComment>
<table border="1" cellpadding="5" cellspacing="1">
<tr>
<td valign="top">
<ul>
<dpLoop var="i" from="1" to="<dpVar top>">
<li><dpArray name="myList" sort="ascending" number="<dpVar i>">
<dpIf <dpVar i> = <dpVar middle>>
</ul>
</td>
<td valign="top">
<ul>
</dpIf>
</dpLoop>
</ul>
</td>
</tr>
</table>
E F F E C T:
<dpArrayElement>
D E F I N I T I O N:
<dpArrayElement> lets you define elements within an array. It is always used in conjunction with <dpArray>.
<dpArrayElement name="arrayName" key="sort value">
Value
</dpArrayElement>
A T T R I B U T E S:
D E T A I L S:
<dpComment>
D E F I N I T I O N:
<dpComment> provides a method for you to put comments within your template. Unlike HTML comments, these comments will be removed when the template is built.
<dpComment>Comment goes here.</dpComment>
<dpComment>
Comment goes here.
</dpComment>
A T T R I B U T E S:
Not applicable.
E X A M P L E S:
<dpComment>
--------------------------------------------------------------------------
Create a list of all the authors in my database.
--------------------------------------------------------------------------
</dpComment>
<dpQuery issue="all" realm="author" sort="author">
<dpAuthor><br>
</dpQuery>
<dpCurrentIssue>
D E F I N I T I O N:
This tag will return the issue/issueID of the latest issue in your database. It's purpose is primarily to use in a conditional test to see if the issue being built is the current issue or not.
<dpCurrentIssue
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
<dpIf <dpIssue> = <dpCurrentIssue>>
{create author archive pages}
</dpIf>
This Week in Film:
<dpQuery issue="<dpCurrentIssue>" section="film">
<dpHeadline link="on"><br>
<dpSummary><p>
</dpQuery>
<dpInclude>
D E F I N I T I O N:
<dpInclude> allows you to pull in (include) a template within a template. This is most commonly used for pulling in a template full of common macros, or design headers and footers.
<dpInclude
template="template name"
>
A T T R I B U T E S:
<dpLength>
D E F I N I T I O N:
<dpLength> returns the length of a string in paragraphs (p), sentences (s), words (w), or characters (c).
<dpLength unit="p|s|w|c">string or tag(s) to evaluate</dpLength>
A T T R I B U T E S:
Not applicable.
E X A M P L E S:
<dpLength unit="w">How many words?</dpLength> would return 3
<dpLength unit="w">How many characters?</dpLength> would return 18
A more common usage would be:
<dpVar totalParagraphs="<dpLength unit="p"><dpStory></dpLength>">
You now have a variable that holds the number of total paragraphs this story has. This can be used for layout purposes, statistical information like word count, a variable to determine if you should split this story into multiple pages, etc.
<dpMath>
D E F I N I T I O N:
<dpMath> lets you perform mathematical calculations within the tag and will return the result.
<dpMath calculation goes here>
O P E R A T O R S:
+, -, *, /, ( )
E X A M P L E S:
<dpMath 4+4> would return 8
<dpMath <dpLength unit="p"><dpStory></dpLength> - 4>
would return the length of the story in paragraphs subtracting 4.
<dpSpawn>
D E F I N I T I O N:
Spawn provides a method for a template to build additional files. This is most commonly used to generate server side includes, or to create and/or update mini sites.
This syntax it used to define a template inline. Mostly common for creating include files.
<dpSpawn path="relative path" file="file name">
template defined here
</dpSpawn>
This syntax references an external template you've defined in the Template Manager. This is a common method for mini sites.
<dpSpawn path="relative path" file="file name" template="template name">
A T T R I B U T E S:
E X A M P L E S:
The following code will build author archives for all of the authors in your database. It uses a template defined in the Template Manager called "author archives".
<dpQuery issue="all" realm="author">
<dpSpawn path="/archives/authors/" file="<dpAuthorID>.html" template="author archives">
</dpQuery>
Navigational Tags
The navigational tags relate specifically to directional navigation within your web site. They allow you to add features such as page forward and page back between stories, threading across issues within a specific column, page numbering systems, or hybrids of all of the above. See <dpQuery> for examples of site navigation related to suggested links, such as "more by this author", "recently in this column", or "other Jazz reviews".
<dpColumnURL>
D E F I N I T I O N:
The URL of a specific column being built or queried. This is most often used to point to the first story within a column, which may be a dynamic element, depending on your publication.
<dpColumnURL
column = "this|column|columnID"
>
A T T R I B U T E S:
<dpColumnURL column="this"> - smith.html
<dpColumnURL column="Jeff Smith"> -
<dpColumnURL column="curr"> - curr.html
E X A M P L E S:
|
<dpColumnURL> |
smith.html |
|
<a href="<dpColumnURL column="curr">">Go to the Currents Features</a> |
Go to the Currents Features |
<dpPageBackURL>
D E F I N I T I O N:
The URL of the previous page from the story currently being built or queried.
<dpPageBackURL>
A T T R I B U T E S:
Not applicable.
E X A M P L E S:
|
<dpPageBackURL> |
mailbag.html |
|
<a href="<dpPageBackURL>"><img src="../images/pageback.gif"></a> |
|
|
<dpIf <dpPageBackUrl>> <a href="<dpPageBackURL>"><img src="../images/pageback.gif"></a> </dpIf> |
|
<dpPageForwardURL>
D E F I N I T I O N:
The URL of the next page from the story currently being built or queried. Page sequence is determined by the order of the stories within pagination.
<dpPageForwardURL>
A T T R I B U T E S:
Not applicable.
E X A M P L E S:
|
<dpPageForwardURL> |
skinny.html |
|
<a href="<dpPageForwardURL>">Page Forward</a> |
Page Forward |
|
<dpIf <dpPageForwardURL>> <a href="<dpPageForwardURL>">Page Forward</a> </dpIf> |
Page Forward |
<dpPageNumber>
D E F I N I T I O N:
The page number of the story currently being built or queried.
<dpPageNumber
type = "issue|section"
position = "this|last|first"
default="default text"
style="lower|upper|title|spaced|roman|decimal|identifier|
noHtml|noHtmlStyle|scriptEncode|uriEncode"
link="on|off"
start="#p|#s|#w|#c|begin|end|resume"
stop="#p|#s|#w|#c|begin|end|resume"
length="#p|#s|#w|#c|begin|end"
>
A T T R I B U T E S:
<dpPageNumber type="issue"> - 2
<dpPageNumber type="section"> - 2
<dpPageNumber type="issue" position="this"> - 2
<dpPageNumber type="issue" position="last"> - 39
<dpPageNumber type="section" position="this"> - 2
<dpPageNumber type="section" position="last"> - 8
Please refer to the common attributes page for the common attribute descriptions.
E X A M P L E S:
|
<dpPageNumber> |
2 |
|
Page <dpPageNumber type="section"> |
Page 2 |
|
<dpPageNumber style="roman"> |
II |
|
The last page in this issue is page <dpPageNumber position="last"> |
The last page in this issue is page 32 |
<dpSectionURL>
D E F I N I T I O N:
The URL of a specific section being built or queried. This is most often used to point to the first story within a section, which may be a dynamic element, depending on your publication.
<dpSectionURL
section = "this|section|sectionID"
>
A T T R I B U T E S:
<dpSectionURL section="this"> - mailbag.html
<dpSectionURL section="City Week"> - cw.html
<dpSectionURL section="cityweek"> - cw.html
E X A M P L E S:
|
<dpSectionURL> |
mailbag.html |
|
The first story in this section is <a href="<dpSectionURL>"><dpSectionURL></a> |
The first story in this section is mailbag.html |
|
<a href="<dpSectionURL section="music">">Go to the Music Section</a> |
Go to the Music Section |
|
<a href="<dpSectionURL section="Currents">">Currents</a> . <a href="<dpSectionURL section="Music">">Music</a> . <a href="<dpSectionURL section="Cinema">">Cinema</a> . <a href="<dpSectionURL section="Books">">Books</a> . <a href="<dpSectionURL section="Review">">Review</a> . <a href="<dpSectionURL section="City Week">">City Week</a> |
Currents . Music . Cinema . Books . Review . City Week |
<dpThreadBackURL>
D E F I N I T I O N:
The URL of the previous story in this column's sequence.
<dpThreadBackURL>
A T T R I B U T E S:
Not applicable.
E X A M P L E S:
|
<dpThreadBackURL> |
../1999-05-07/smith.html |
|
<a href="<dpThreadBackURL>">Previously in this column</a> |
Previously in this column |
|
<dpIf <dpThreadBackURL>> <a href="<dpThreadBackURL>">Previously in this column (error checked)</a> </dpIf> |
Previously in this column (error checked) |
Queries
Queries allow you to query your database to find matches based on the criteria you set within the query tag. Common uses of queries include table of contents pages, suggested links, more stories by a specific author, previously in this column, page numbering systems, query if a story is running or not this issue, and much, much more.
<dpQuery>
D E F I N I T I O N:
<dpQuery
issue="this|all|archives|issue|issueID|
-this|-all|-archives|-issue|-issueID"
section="this|all|section|sectionID|
-this|-all|-section|-sectionID"
column="this|all|column|columnID|
-this|-all|-column|-columnID"
author="this|all|author|authorID|
-this|-all|-author|-authorID"
columnType="all|column|interstitial|
-all|-column|-interstitial"
userField="name|match|value"
volumeNumber="#|-#"
issueNumber="#|-#"
includethis="yes|no"
paginated="yes|no|all"
max="#"
min="#"
sort="issue|section|column|author|story|
-issue|-section|-column|-author|-story"
exclude="<dpQuery>"
realm="author|column|section|issue"
return="value|count"
>
Simple Query Format:
<dpQuery>
{Looping Query Section}
</dpQuery>
The query tag is a container tag, meaning it requires an opening and closing tag: <dpQuery></dpQuery>. To define and execute a query, the above syntax is all that is needed. However, you will usually use at least one attribute to refine your query for your specific needs.
Everything that appears within the {Looping Query Section} will be repeated for each match.
For example, the following syntax queries all of the publication's archives looking for matches of the cinema column. If it finds a match, it will output a linked headline of the matching story.
|
<dpQuery column="cin"> <dpHeadline link="on"> </dpQuery> |
Native Talent Last Night Stand Seeing Through The Roos X Marks The Plot etc. |
Complete Query Format:
The query tag also includes additional tags that can be optionally used within the query container to extend the functionality of the query tag.
<dpQuery>
{Header Section}
<dpLoop>
{Looping Query Section}
</dpLoop>
{Footer Section}
<dpFail>
{Failed Query Section}
</dpQuery>
The advantage to using the <dpLoop></dpLoop> container tag is so that you can define a {Header Section} and/or a {Footer Section}
The header and footer sections will only be displayed once for the entire query, where the information within the <dpLoop></dpLoop> container tag will be displayed for each match. Please see the examples below.
A T T R I B U T E S:
issue="this" - This is the default value and only queries the issue being built.
issue="all" - Queries all issues, including the issue being built.
issue="archives" - Queries all issues before the issue being built. The issue being built is not included, only the issues that precede it in date. Most commonly used for suggested links.
issue="issue|issueID" - You can specify a specific issue using <dpIssue>/<dpIssueID> format: yyyy-mm-dd. Example: issue="1999-10-22"
section="this" - limits the query to the current section being built. For example, if the page being built is in the film section, it would only query film.
section="all" - queries all sections. This is the default value.
section="section|sectionID" - queries a specific section you designate. Both <dpSection> & <dpSectionID> syntax can be used. Example: section="music"
column="this" - limits the query to the current column being built. For example, if the story being built is a cinema feature column, it would only query other stories that are cinema feature columns.
column="all" - queries all columns. This is the default value.
column="column|columnID" - queries a specific column you designate. Both <dpColumn> & <dpColumnID> syntax can be used. Example: column="cover"
author="this" - limits the query to the current author of the story being built. For example, if the story being built is written by Jeff Smith, it would only query other stories that were written by Jeff Smith.
author="all" - queries all authors. This is the default value.
author="author|authorID" - queries a specific author you designate. Both <dpAuthor> & <dpAuthorID> syntax can be used.
paginated="yes" - limits the query to paginated pages only. This is the default.
paginated="no" - limits the query to non-paginated pages only.
paginated="all" - queries both paginated and non-paginated pages.
includethis="yes" - tells the query to include itself, the story currently being built, within the query.
includethis="no" - tells the query not to include itself, the story currently being built, within the query. This is the default.
+ = ascending
- = descending
For example:
The following code first creates a list of up to 3 (max="3") stories by "this" author from the archives. It then performs a test to see if there were greater than 3 (gt 3) stories by this author in the archives. If there were, it puts in a link to their author archive page. If there weren't, nothing is displayed. The goal here was to prevent the "more..." link from being displayed unless there truly were more. <dpQuery return="count"> makes it easy to achieve this, and avoids incrementing variables.
<dpQuery issue="archives" author="this" max="3">
More by <dpAuthor>:<br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
</dpQuery>
<dpIf <dpQuery issue="archives" author="this" return="count"> gt 3>
<a href="../archives/authors/<dpAuthorID>.html">more...</a><br>
</dpIf>
Another example for comparison:
Note: return="value" is the default, and therefore not needed.
<dpQuery issue="archives" column="music">
<dpHeadline><br>
</dpQuery>
would return this:
The Sound and the Fury
Scavengers of the Vast Wasteland
Make Your Mama Proud
High Impact
---
<dpQuery issue="archives" column="music" return="count">
would return "4".
E X A M P L E S:
|
<dpQuery column="cin"> <b>Recently in this column:</b><br> <dpHeadline link="on"><br> </dpQuery> |
Recently in this column: Native Talent Recently in this column: Last Night Stand Recently in this column: Seeing Through The Roos Recently in this column: X Marks The Plot etc. |
|
<dpQuery column="cin"> <b>Recently in this column:</b><br> <dpLoop> <dpHeadline link="on"><br> </dpLoop> </dpQuery> |
Recently in this column: Native Talent Last Night Stand Seeing Through The Roos X Marks The Plot etc. |
|
<b>Recently in this column:</b><br> <dpQuery column="danehy"> <dpHeadline link="on"><br> </dpQuery> |
Recently in this column: |
|
<b>Recently in this column:</b><br> <dpQuery column="danehy"> <dpHeadline link="on"><br> <dpFail> No matches found<br> </dpQuery> |
Recently in this column: No matches found |
Also in this Section [1/2]
The following query would be a common query to include on a sectional table of contents, like for your music or film section.
T A G C O D E:
<dpQuery issue="this" section="music">
<dpHeadline link="on"><br>
<dpSummary>
<p>
</dpQuery>
E F F E C T:
The Burden of Spoof
Prince of parody Weird Al Yankovic polkas into the TCC on March 1.
Soundbites
Making mountains out of Molehill... The BMI Showcase lowdown... Soundbites salutes Al Perry... and more!
Rhythm & Views
Wise words on the latest from The Rusty Boys.
Club Listings
What's happening at Tucson night spots this week.
Also in this Section [2/2]
The following query picks up where the previous left off, but makes it more dynamic and multi-purpose for all table of contents pages by using "this" rather then hard coding "music". It also tests for an author and displays the author name(s) if the story is credited.
T A G C O D E:
<dpQuery issue="this" section="this">
<dpHeadline link="on"><br>
<dpSummary><br>
<dpIf <dpAuthor>>
<dpAuthorCredit> <dpAuthor>
</dpIf>
<p>
</dpQuery>
E F F E C T:
The Burden of Spoof
Prince of parody Weird Al Yankovic polkas into the TCC on March 1.
By Curtis McCrary
Soundbites
Making mountains out of Molehill... The BMI Showcase lowdown... Soundbites salutes Al Perry... and more!
By Stephen Seigel
Rhythm & Views
Wise words on the latest from The Rusty Boys.
Fred Mills
Club Listings
What's happening at Tucson night spots this week.
Using the Negate Operator
There are often scenarios where you want to query over a section, but exclude a column or a few columns. This can be achieved simply by using the negate operator. For example, say we want to list all the stories in the film section, but not the film times, or tv times. Here's how that works:
T A G C O D E:
<dpQuery issue="this" section="film" column="-filmtimes" column="-tvtimes">
<dpHeadline link="on"><br>
<dpSummary>
<p>
</dpQuery>
E F F E C T:
Billionaire Boys Flub
Skip "Boiler Room" and rent "Glengarry Glen Ross" or "Wall Street" instead.
Film Clips
Check out Tucson Weekly's capsule reviews.
More by this Author [1/4]
The following query searches through all of the archives looking for additional stories by this author. If matches are found it will display the output and return a maximum of 3 links. Note: if no matches are found, the "More by this author:" will still be displayed.
T A G C O D E:
<b>More by this author:</b><br>
<dpQuery issue="archives" author="this" max="3">
<dpHeadline link="on"><br>
</dpQuery>
E F F E C T:
More by this author:
Savage Love
Germ Warfare
Cross Your Heart
More by this Author [2/4]
The following query searches through all of the archives looking for additional stories by this author. If matches are found it will display the output and return a maximum of 3 links. If no matches are found, nothing will be displayed.
In addition to preventing anything from being displayed if no matches are found, this version has replaced the word "author" with the author's name, and added a summary and issue date.
T A G C O D E:
<dpQuery issue="archives" author="this" max="3">
<b>More by <dpAuthor>:</b><p>
<dpLoop>
<dpHeadline link="on"><br>
<dpSummary>
<font size="2">[<dpIssueDate begin="%m-%d-%Y">]</font>
<p>
</dpLoop>
</dpQuery>
E F F E C T:
More by Dan Savage:
Savage Love
Las Vegas is a sexy city, and I am a sheltered Seattleite. I want to explode! Should I become a showgirl?
[01-20-2000]
Savage Love
Making any special plans for New Year's Eve? Prepared for Y2K? Laying in any provisions?
[12-30-1999]
Cross Your Heart
I recently met an ambitious, attractive, charming, talented, and terrific young woman. One MAJOR problem, though...
[12-09-1999]
More by this Author [3/4]
This version of more by this author takes into consideration that a story may have more than one author and in that scenario it should display suggested links for each of the authors independently. This is achieved by creating a loop that processes each author one at a time. If there is only one author, it will display the one like before, but if there are multiple, it will list them out one after the other.
T A G C O D E:
<dpLoop var="i" from="1" to="<dpAuthor return="count">">
<dpQuery issue="archives" author="<dpAuthorID number="<dpVar i>">" max="3">
<b>More by <dpAuthor number="<dpVar i>">:</b><p>
<dpLoop>
<dpHeadline link="on"><br>
<dpSummary>
<font size="2">[<dpIssueDate begin="%m-%d-%Y">]</font>
<p>
</dpLoop>
<p><br>
</dpQuery>
</dpLoop>
E F F E C T:
More by Phil Campbell:
Of Rags and Riches
[11-18-1999]
Facing the Mob
[11-11-1999]
One Step Forward...
[11-11-1999]
More by Josh Feit:
Windows for Unions
[11-18-1999]
Last Train to Debtsville
Light rail planning gets heavy as Schell gets pissy and wants to borrow more money. By JOSH FEIT
[11-11-1999]
Seattle Weekly Up for Sale
[09-30-1999]
More by Jennifer Vogel:
Sliced Eyeballs
[10-28-1999]
A D D I T I O N A L I N F O R M A T I O N:
To explain this in more detail, let's first examine what the loop does by simplifying it a bit. The loop is defined as being a number from "1" to the amount of authors a story has. If the story has 3 authors, it will loop three times (from 1 to 3). The variable "i" will contain the loop number it is currently on. Here's what it would look like if you had 3 authors on a story.
All authors: <dpAuthor><br>
<dpLoop var="i" from="1" to="<dpAuthor return="count">">
Author <dpVar i>: <dpAuthor number="<dpVar i>"><br>
</dpLoop>
The default setting for <dpAuthor> is <dpAuthor number="all"> which displays all the authors of a story. By setting the number value to a literal like number="2", we are able to extract the second author only.
The full version of this query uses this principle to run the query once per author, taking special care that the appropriate author is referenced within the query itself.
More by this Author [4/4]
This example picks up where the previous left off and adds an enhancement of testing to see if the author had more then 3 stories. If she/he did, a link is inserted to link them to an author archive for their complete list. This author archive would be something you would have created using the <dpSpawn> tag.
This test is achieved by performing another query about the author, but this time only returning the "count" of how many matches the query made. This is then compared to see if it is greater than 3 and if so, the more link is added.
T A G C O D E:
<dpLoop var="i" from="1" to="<dpAuthor return="count">">
<dpQuery issue="archives" author="<dpAuthorID number="<dpVar i>">" max="3">
<b>More by <dpAuthor number="<dpVar i>">:</b><p>
<dpLoop>
<dpHeadline link="on"><br>
<dpSummary>
<font size="2">[<dpIssueDate begin="%m-%d-%Y">]</font>
<p>
</dpLoop>
<dpIf <dpQuery issue="all" author="<dpAuthorID number="<dpVar i>">" return="count"> gt 3>
<a href="../archives/<dpAuthorID number="<dpVar i>">.html">more...</a>
</dpIf>
<p><br>
</dpQuery>
</dpLoop>
E F F E C T:
More by Phil Campbell:
Of Rags and Riches
[11-18-1999]
Facing the Mob
[11-11-1999]
One Step Forward...
[11-11-1999]
More by Josh Feit:
Windows for Unions
[11-18-1999]
Last Train to Debtsville
Light rail planning gets heavy as Schell gets pissy and wants to borrow more money. By JOSH FEIT
[11-11-1999]
Seattle Weekly Up for Sale
[09-30-1999]
More by Jennifer Vogel:
Sliced Eyeballs
[10-28-1999]
Recently in this Column
The following query searches through all of the archives looking for additional stories previously in this column. If matches are found it will display the output and return a maximum of 3 links. If no matches are found, nothing will be displayed.
T A G C O D E:
<dpQuery issue="archives" column="this" max="3">
<b>Recently in <dpColumn>:</b><p>
<dpLoop>
<dpHeadline link="on"><br>
<dpSummary>
<font size="2">[<dpIssueDate begin="%m-%d-%Y">]</font>
<p>
</dpLoop>
</dpQuery>
E F F E C T:
Recently in I, Anonymous:
Drop the Chalupa
I am sick to the guillotines in regards to that spoiled Chihuahua on TV. Did you know they use irritants for the mouth motion? Would you like to know what else makes me sick?!?
[11-18-1999]
Mumia Shmoomia
To the zealots who staged the "Free Mumia" protest rally that clogged up Third and Fourth Avenue during rush hour on Friday, October 22nd
[11-11-1999]
Rookie of the Year
Hey NFL Rookie! You know you hurt me, right?
[11-04-1999]
Using the Exclude Attribute
The exclude attribute is most commonly used when you have a few groupings of suggested links, and want to make sure their is no redundancy. For example, if you had "previously in this column", and "recently by this author", there could be the same links listed in both places. Here's how you prevent that.
T A G C O D E:
Before:
<dpQuery issue="archives" column="this" max="3">
<b>Previously in <dpColumn>:</b><br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
</dpQuery>
<dpQuery issue="archives" author="this" max="3">
<b>Recently by <dpAuthor>:</b><br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
</dpQuery>
After:
<dpQuery issue="archives" column="this" max="3">
<b>Previously in <dpColumn>:</b><br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
</dpQuery>
<dpQuery issue="archives" author="this" max="3" exclude="<dpQuery issue="archives" column="this" max="3">">
<b>Recently by <dpAuthor>:</b><br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
</dpQuery>
E F F E C T:
Before:
Previously in Music:
MP3s Basically Suck
Heat Seeking
Shaolin Slangmaster
Recently by Erin Franzman:
MP3s Basically Suck
Welcome
Going Underground
After:
Previously in Music:
MP3s Basically Suck
Heat Seeking
Shaolin Slangmaster
Recently by Erin Franzman:
Welcome
Going Underground
If You Don't Have Anything Nice to Say, Tell the Truth Anyway
A D D I T I O N A L I N F O R M A T I O N:
Notice the exclude attribute in the second query. This exclude lists a query of results you want to exclude, like a subset. In this case, it excludes any result that would have been in the query before it.
Suggested Links Within a Drop-down menu (Select)
Say you want to list your suggested links in a drop-down menu, rather then on the page itself. You would do this simply by adding the appropriate form elements to the query, so that Dispatch can build the form. Note: this version requires JavaScript.
T A G C O D E:
<form onSubmit="document.location.href=myNav.options[myNav.options.selectedIndex].value; return false">
<select name="myNav">
<dpQuery issue="archives" column="this" max="20">
<option value="../<dpIssue>/<dpFile>"><dpHeadline>
</dpQuery>
</select>
<input type="submit" value="go">
</form>
E F F E C T:
Other Music Reviews in this Issue [1/2]
Say you want to chain stories of the same column together within an issue, like all of the music reviews. Here's how you would achieve that.
T A G C O D E:
Hard coded version:
<dpQuery issue="this" column="music_reviews">
<b>More Music Reviews in this issue:</b><br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
</dpQuery>
More dynamic version:
<dpQuery issue="this" column="this">
<b>More <dpColumn> in this issue:</b><br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
</dpQuery>
E F F E C T:
More Music Reviews in this issue:
Conceptual Chaos
The Shirt Off Your Back
Shamrocks and Glocks
Jones on the Jukebox
CD Review Revue
Other Music Reviews in this Issue [2/2]
In this example, we will have two queries. One to connect to other music reviews in the issue the reader is reading, and a second query to recent record reviews. This is an interesting way to provide two directional navigation.
T A G C O D E:
<dpQuery issue="this" column="music">
<b>More Music Reviews in this issue:</b><br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
<p>
</dpQuery>
<dpQuery issue="archives" column="music" max="5">
<b>Recent Music Reviews:</b><br>
<dpLoop>
<dpHeadline link="on"> <font size="2">[<dpIssueDate begin="%m-%d-%Y">]</font><br>
</dpLoop>
</dpQuery>
E F F E C T:
More Music Reviews in this issue:
Conceptual Chaos
The Shirt Off Your Back
Shamrocks and Glocks
Jones on the Jukebox
CD Review Revue
Recent Music Reviews:
MP3s Basically Suck [02-03-2000]
Heat Seeking [02-03-2000]
Shaolin Slangmaster [02-03-2000]
The Last Classic Rock Band [01-27-2000]
Utilizing the Usage [01-27-2000]
Listing All Columns With Realm
The following will query over all your issues to find all the unique columns in your database. The realm attribute and value of "column" limits this query to only one result per column.
T A G C O D E:
<dpQuery issue="all" realm="column">
<dpColumn><br>
</dpQuery>
E F F E C T:
News Index
City
In Other News...
Police Beat
Last Days
Columns Index
Savage Love
I Love Television
This Week on TV
etc...
A D D I T I O N A L I N F O R M A T I O N:
To make the list more readable, you can also add sort="column" to sort by the column name.
<dpQuery issue="all" realm="column" sort="column">
<dpColumn><br>
</dpQuery>
All Ages Action
Art
Arts Index
Big Cover
Book Review Revue
Book Supplement
Books
Calendar Index
CD Review Revue
Celeb
Chow
City
City of Paris
Club Directory
etc...
Querying by Issue Volume and/or Issue Number
You can list all of stories from a single volume number by querying over all of your issues to finding matches for the specific volume number.
T A G C O D E:
<dpQuery issue="all" volumeNumber="8">
<dpHeadline link="on"><br>
</dpQuery>
Or perhaps you only want volume number 8 and issue numbers 4 and 6:
<dpQuery issue="all" volumeNumber="8" issueNumber="4" issueNumber="6">
<dpHeadline link="on"><br>
</dpQuery>
E F F E C T:
Preventing Interstitials from showing up in Queries
By default both interstitials and columns will show up in queries. You can override this default using the columnType attribute.
The following will limit results to columns only, thus preventing interstitials from showing up:
T A G C O D E:
<dpQuery issue="this" columnType="column">
<dpHeadline link="on"><br>
</dpQuery>
E F F E C T:
A D D I T I O N A L I N F O R M A T I O N:
The following will do the opposite and only return interstitials in the results:
<dpQuery issue="this" columnType="interstitial">
<dpHeadline link="on"><br>
</dpQuery>
And the default columnType setting will return both insterstitials and columns:
<dpQuery issue="this" columnType="all">
<dpHeadline link="on"><br>
</dpQuery>
Fuzzy and Fuzzier: Part 1
You have been cataloging film stories with film genres, film titles, film directors, and film stars (actors) for the past few months. How can you best use this information?
T A G C O D E:
Film Genre Matching Example:
The following query will search through all of the archives, matching all stories with similar film genres to this story. It will then sort those results using a fuzzy algorithm that weights the matched stories from the best to the worst matches. Once this sort is complete, the query tag will return up to five matches from the top. In summary, you get the best five stories matching on similar film genres.
<dpQuery issue="archives" userField="film genre" sort="fuzzy" max="5">
<dpHeadline link="on"><br>
</dpQuery>
-----------
Here's a modified version with some debugging output, and a higher max so you can see what the results would have been and what film genres each story had:
The following lists the headline and film genres of the story you would be reading. It then lists 5 suggested links matching on film genres. Each links displays the headline and film genres of that story.
<dpHeadline> (<dpUserField name="film genre" number="all">)
<p>
Suggested Links:<br>
<dpQuery issue="archives" userField="film genre" sort="fuzzy" max="5">
<dpHeadline link="on"> (<dpUserField name="film genre" number="all">)<br>
</dpQuery>
The results:
The Body Snatcher (Classic, Horror)
Suggested Links:
Planet of the Vampires (Classic, Horror)
The Changeling (Horror)
The Exorcist (Horror)
Halloween (Horror)
House of Wax (Horror)
As you can see, the story contained the genres: classic and horror. The
query then matched all stories containing "classic" and/or "horror". It then sorted them by the best (the ones with both classic and horror) to the worst (the ones with just classic or horror).
------
Before we move on to more complex queries (those using multiple user fields), let's examine what sort="fuzzier" does. sort="fuzzier" assigns a random value to like weighted matches mixing them up a bit. The concept here is to avoid favoritism, in which the same links get used a too often on suggested links.
If we run the above query again and again right now, it will always return those same five films in that same order. However, if we use sort="fuzzier", the equal weighted "horror" films will get mixed up and may provide different results.
For example:
Suggested Links:<br>
<dpQuery issue="archives" userField="film genre" sort="fuzzier" max="5">
<dpHeadline link="on"> (<dpUserField name="film genre" number="all">)<br>
</dpQuery>
Suggested Links:
Planet of the Vampires (Classic, Horror)
Sleepy Hollow (Horror)
The Changeling (Horror)
The Exorcist (Horror)
Halloween (Horror)
and a second time:
Suggested Links:
Planet of the Vampires (Classic, Horror)
The Texas Chainsaw Massacre (Horror)
Sleepy Hollow (Horror)
Halloween (Horror)
From Beyond (Horror)
So, which should you use? That's up to you. We would recommend sort="fuzzier" if you want to mix up the suggested links just a bit more, hence the name fuzzier.
Next, how to get even better suggested links, by using multiple user fields...
E F F E C T:
Fuzzy and Fuzzier: Part 2
In Part 1, we saw how you can use sort="fuzzy" and sort="fuzzier" to find suggested links based on a user field match. In this part we discuss how to fine tune this process.
T A G C O D E:
We have showed queries like this:
Suggested Links:<br>
<dpQuery issue="archives" userField="film genre" sort="fuzzy" max="5">
<dpHeadline link="on"> (<dpUserField name="film genre" number="all">)<br>
</dpQuery>
instead of this:
<dpQuery issue="archives" userField="film genre" sort="fuzzy" max="5">
Suggested Links:<br>
<dpLoop>
<dpHeadline link="on"> (<dpUserField name="film genre" number="all">)<br>
</dpLoop>
</dpQuery>
The reason we are doing this is for ease of readability. When you actually use these queries we always recommend using the latter version with the <dpLoop>. Why? Mainly because of the "Suggested Links:" header. In the first example, the suggested links header will always display regardless of whether any matches are found. The second version will only display the suggested links header if the query is successful. This is a much better approach and the recommended version.
-------
Now, back to sort="fuzzy".
Let's look at the example of matching film genres for a film that may have few genres associated with it:
<dpHeadline> (<dpUserField name="film genre" number="all">)
<p>
Suggested Links:<br>
<dpQuery issue="archives" userField="film genre" sort="fuzzy" max="5">
<dpHeadline link="on"> (<dpUserField name="film genre" number="all">)<br>
</dpQuery>
This could return results like this for the film "I Love You to Death" which is just a comedy.
I Love You to Death (Comedy)
Suggested Links:
The Flim-Flam Man (Comedy)
The Muse (Comedy)
The Ruling Class (Comedy)
The Producers (Comedy)
Bicentennial Man (Comedy)
Granted, those matches are of other comedy films, but they are all over the map and don't necessarily have anything in common with "I Love You to Death" outside of also being funny.
Here's how we can improve the match...
--------
Our examples so far have used only one user field, however our demo publication, Baltimore CityPaper, catalogs a lot more rich meta information about their film reviews, such as film stars (actors), and film directors. Using this additional information, we can refine our query:
<dpQuery issue="archives" userField="film genre" userField="film director" userField="film stars" sort="fuzzy" max="5">
Here it is with all the additional debugging information, so we analyze the results:
<dpHeadline>
(<dpUserField name="film genre" number="all">)
(<dpUserField name="film director" number="all">)
(<dpUserField name="film stars" number="all">)
<p>
Suggested Links:<br>
<dpQuery issue="archives" userField="film genre" userField="film director" userField="film stars" sort="fuzzy" max="5">
<dpHeadline link="on">
(<dpUserField name="film genre" number="all">)
(<dpUserField name="film director" number="all">)
(<dpUserField name="film stars" number="all">)<br>
</dpQuery>
I Love You to Death (Comedy) (Lawrence Kasdan) (Kevin Kline, Tracey Ullman, River Phoenix)
Suggested Links:
Mumford (Comedy) (Lawrence Kasdan) ()
The January Man (Comedy, Suspense) (Pat O'Conner) (Kevin Kline, Harvey Keitel, Susan Sarandon)
Illuminata (Comedy) (John Turturro) (John Turturro)
The Dinner Game (Comedy, Foreign) (Francis Veber) ()
Tapeheads (Comedy) (Bill Fishman) (John Cusack, Tim Robbins)
"I Love You to Death" is a comedy directed by Lawrence Kasden starring Kevin Kline, Tracey Ullman, River Phoenix. Using all of this information, the sort="fuzzy" was able to group the best matches first.
"Mumford" is also a comedy by the same director.
"The January Man" is also a comedy starring Kevin Kline.
The rest are looser matches, but you can see as a database becomes more populated, you have the ability to link to the best matches first.
Next, further refinements for multiple user field matches....
E F F E C T:
Fuzzy and Fuzzier: Part 3
Previously, we've examined single user field matches, and compound user field matches. Now, we examine how to further fine tune the compound user field matches:
T A G C O D E:
The query we last analyzed was:
<dpHeadline>
<p>
Suggested Links:<br>
<dpQuery issue="archives" userField="film genre" userField="film director" userField="film stars" sort="fuzzy" max="5">
<dpHeadline link="on"><br>
</dpQuery>
which returned the following:
I Love You to Death (Comedy) (Lawrence Kasdan) (Kevin Kline, Tracey Ullman, River Phoenix)
Suggested Links:
Mumford (Comedy) (Lawrence Kasdan) ()
The January Man (Comedy, Suspense) (Pat O'Conner) (Kevin Kline, Harvey Keitel, Susan Sarandon)
Illuminata (Comedy) (John Turturro) (John Turturro)
The Dinner Game (Comedy, Foreign) (Francis Veber) ()
Tapeheads (Comedy) (Bill Fishman) (John Cusack, Tim Robbins)
If you feel that an actor match is more important than a director match, or that a genre match should be the highest, how can you weight the most important field to match on?
By adding weights to the user field values. These values can be any positive or negative decimal number. The following will weight the film stars as the most important match criteria:
<dpHeadline>
<p>
Suggested Links:<br>
<dpQuery issue="archives" userField="film genre" userField="film director" userField="film stars(5)" sort="fuzzy" max="5">
<dpHeadline link="on"><br>
</dpQuery>
Note the addition of (5) after the user field film stars.
Here's the results (with debugging info):
The January Man (Comedy, Suspense) (Pat O'Conner) (Kevin Kline, Harvey Keitel, Susan Sarandon)
Suggested Links:
I Love You to Death (Comedy) (Lawrence Kasdan) (Kevin Kline, Tracey Ullman, River Phoenix)
Blue Collar (Drama) (Paul Schrader) (Richard Pryor, Yaphet Kotto, Harvey Keitel)
Anywhere but Here (Drama, Literary Adaption) (Wayne Wang) (Susan Sarandon, Natalie Portman)
Illuminata (Drama, Literary Adaption) (John Turturro) (John Turturro, Katherine Borowitz, Donal McCann, Beverly D'Angelo, Susan Sarandon, Christopher Walken, Bill Irwin)
Mumford (Comedy) (Lawrence Kasdan) ()
"I Love You to Death" was the best match since it matched a film star and a genre. "Blue Collar" came in second only matching a film star, and the same with "Anywhere but Here" and "Illuminata".
As you can see, weighting the film stars heavily shifted emphasis and may have actually strayed from best matches in our case.
-----
Here are a few more examples:
This weights film stars highest, then film genres, then film directors.
<dpQuery issue="archives" userField="film genre(2)" userField="film stars(3)" userField="film director" sort="fuzzy" max="5">
<dpHeadline link="on"><br>
</dpQuery>
This sets a negative value on directors to say they are bad matches and you'd rather not have them (probably not true in this case).
<dpQuery issue="archives" userField="film genre(2)" userField="film stars(3)" userField="film director(-10)" sort="fuzzy" max="5">
<dpHeadline link="on"><br>
</dpQuery>
-----
Hopefully this series has showcased the potential of userField matches when combined with fuzzy sorts. The suggested links possibilities are endless.
E F F E C T:
Variables & Macros
Variables and Macros allow you to create your own macro subroutines, or save a value in a variable for later use within your template. A common use of macros would be a capsule style layout for your table of contents pages, or a subroutine to create suggested author links. It is also common to place all of your site's macros in their own file that your templates can all reference. Organizing your templates like this, can aid in streamlining and modifying your templates.
<dpMacro>
D E F I N I T I O N:
Macros are similar to variables, but rather than setting a value they define a series of instructions you can use within your template. If you end up doing the same thing more then once within your template, macros are usually a helpful shorthand.
<dpMacro macroName="value">
or
<dpMacro macroName>value</dpMacro>
Macro Usage:
<dpMacro macroName>
A T T R I B U T E S:
Not applicable.
E X A M P L E S:
<dpMacro myCapsuleStyle>
<b><dpHeadline link="on"></b><br>
<dpSummary><br>
<dpAuthor><p>
</dpMacro>
<dpQuery section="music">
<dpMacro myCapsuleStyle>
</dpQuery>
<dpQuery section="film">
<dpMacro myCapsuleStyle>
</dpQuery>
<dpMacroDefine>
D E F I N I T I O N:
<dpMacroDefine> is the preferred way of defining macros. By defining macros with <dpMacroDefine> you have the extra advantage of being able to call a macro from within macro definition.
<dpMacroDefine macroName>
macro
</dpMacroDefine>
A T T R I B U T E S:
Not applicable.
E X A M P L E S:
<dpMacroDefine linkLayout>
<dpHeadline><br>
<dpSummary><p>
</dpMacroDefine>
<dpMacroDefine sectionLinks>
<dpQuery issue="this" section="this">
<dpMacro linkLayout>
</dpQuery>
</dpMacroDefine>
<dpVar>
D E F I N I T I O N:
Variables allow you to create your own variables you can use within a template. Variables are usually used to save or set values you want to reference later in your template.
<dpVar variableName="value">
or
<dpVar variableName>value</dpVar>
Variable Usage:
<dpVar variableName>
A T T R I B U T E S:
Please refer to the common attributes page for additional details on the style attribute.
E X A M P L E S:
<dpVar myName="Deuteronomy">
My name is <dpVar myName>
would display
My name is Deuteronomy
<dpIf <dpColumnID>="feature">
<dpVar headerImage="cool_image.gif">
<dpElse>
<dpVar headerImage="plain_image.gif">
</dpIf>
<img src="<dpVar headerImage>">
would display cool_image.gif if it was the feature and plain_image.gif if it wasn't.
Using Styles with <dpVar>
Styles can be used with <dpVar> just as with any other display tag within Dispatch. However, you must always state the name of the variable first and then follow it with the desired styles. The following will NOT work: <dpVar style="upper" myIntro>
T A G C O D E:
Declare a variable:
<dpVar myIntro="Hello World">
or
<dpVar myIntro>Hello World</dpVar>
Apply the desired styles:
<dpVar myIntro style="upper"> - HELLO WORLD
<dpVar myIntro style="upper" style="spaced"> - H E L L O W O R L D
E F F E C T:
<dpVarDefine>
D E F I N I T I O N:
<dpVarDefine> is the preferred method of defining variables. The advantage to using <dpVarDefine> is the ability to nest variables. Note: all leading and trailing padding is removed from the variable definition.
<dpVarDefine variableName>
variable
</dpVarDefine>
A T T R I B U T E S:
Please refer to the common attributes page for additional details on the style attribute.
E X A M P L E S:
<dpVarDefine myCounter>
0
</dpVarDefine>
<dpVarDefine myCounter>
<dpMath <dpVar myCounter> + 1>
</dpVarDefine>
| Home: Support: Reference Guide | Questions? Comments? Please write support@desert.net. |