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 |
| Home: Support: Reference Guide: Display Tags | Questions? Comments? Please write support@desert.net. |