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