Table of Contents

txp:article

The basic article tag is a Single Tag and generally used in a Page template. The tag is used to output one or more articles depending on Attributes used. Default attributes will be used when nothing specific is assigned.

article is context-sensitive, which means it will grab articles from the currently viewed section/category/author, etc. When used on the front page, article's context will include articles from all sections set to display “On front page”.

Syntax

The article tag has the following syntactic structure…

<txp:article />

Attributes

Tag will accept the following attributes (case-sensitive):

customfieldname="value"

Restrict to articles with specified value for specified custom field name. Replace “customfieldname” with the name of the custom field.

keywords="keyword"

Restrict to articles with specified keyword(s).

status="status"

Restrict to articles with specified status. Available values: draft, hidden, pending, live, sticky. Default is live.

time="time"

Restrict to articles posted within specified timeframe. Available values: past, future, or any (both past and future). Default is past.

sort="sort value(s)"

How to sort resulting list. Available values: ID (article id#), AuthorID (author), LastMod (date last modified), LastModID (author of last modification), Posted (date posted), Title, Category1, Category2, comments_count, Status, Section, Keywords, Image (article image id#), url_title, custom_1 through custom_10, rand() random. When viewing a search results list, score (how well the search terms match the article) is an additional value available. Default value is Posted desc (score desc for search results).

offset="integer"

The number of articles to skip. Default is 0.

limit="integer"

The number of articles to display. Default is 10.

pageby="integer"

The number of articles to jump forward or back when an older or newer link is clicked. Allows you to call the article tag several times on a page without messing up older/newer links. Default value matches the value assigned to limit.

pgonly="boolean"

Do the article count, but do no display anything. Used when you want to show a search result count, or article navigation tags before the list of articles. Just Make sure that, other than pgonly, both article tags are identical (form-related attributes are the exception, they do not need to be assigned). Default is 0 (no).

allowoverride="boolean"

Whether to use override forms for the generated article list. Default is 1 (yes).

searchsticky="boolean"

When outputting search results, include articles with status “sticky”. Default is 0 (no).

form="form name"

Use specified form. Default is default.

listform="form name"

Use specified form when page is displaying an article list.

searchform="form name"

The form to be used for your customized search results output. Default is: search_results.

Examples

Will display 5 articles using the article form Default

<txp:article form="default" limit="5" />

Will display 5 articles starting with the third article in the sort order

<txp:article offset="2" limit="5" />

Using pageby to split article output on a page

<div id="first"><txp:article limit="1" pageby="10" /></div>
<div id="middle"><txp:article limit="8" offset="1" pageby="10" /></div>
<div id="last"><txp:article limit="1" offset="9" pageby="10" /></div>

The pageby number should be the total number of articles displayed on the page. Without pageby, each article tag would page independently based on its own limit, as if it was the only article tag.

<txp:article limit="5" pageby="10" />
<!-- google ad -->
<txp:article limit="5" offset="5" pageby="10" />

Will display articles that have a custom field named "colour" with a value "red"

<txp:article colour="red" />

Sort articles by author (a-z) then by date (oldest to newest)

<txp:article sort="AuthorID asc, Posted asc" />

Genealogy

Version 4.0.4

Version 4.0.2