<txp:article />
The basic article tag can be used as either a single tag or container tag and used to output one or more articles depending on the attributes used. Default attributes will be used when nothing specific is assigned.
It may be used as a container tag, in which case it must be specified as an opening and closing pair of tags, like this:
<txp:article> ...contained statements... </txp:article>
This is equivalent to putting the contained statements into a form named "my_form" and using <txp:article form="my_form" />
.
The tag 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".
Tag will accept content/behaviour and presentation attributes (case-sensitive).
1
(yes).default
.10
.0
.limit
.0
(no).1
.search_results
.0
(no).ID
(article id#)AuthorID
(author name)LastMod
(date last modified)LastModID
(author name of last modification)Posted
(date posted)Expires
(expiry date)Title
Category1
Category2
comments_count
Status
Section
Keywords
Image
(article image id#)url_title
custom_1
through custom_10
custom_n
)(custom_n+0)
"rand()
(random). textpattern
database table can be used as a sort key. score
(how well the search terms match the article) Posted desc
(score desc
for search results)live
or sticky
live
.past
, future
, or any
(both past
and future
). past
.These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
labeltag="h3"
)wraptag="ul"
)wraptag
attribute value.break="li"
) or some string to separate list items.br
(but see break cross-reference for exceptions).The article tag is context-sensitive. It will produce different results depending on whether the page being viewed is an article list or an individual article. Article-list context includes the default (home) page, section front pages, and category pages. Individual-article context applies on an article page (i.e., a page with a URL like <http://example.com/archives/24/my-article>
).
Here is the article tag responsible for the main content of the home page on a new Textpattern 4.0.7 installation:
<txp:article limit="5" />
limit
attribute to specify the maximum number of articles displayed in article list context. (If not specified, this defaults to 10.)Expanding on example 1, here is the article tag responsible for showing lists of articles by category in the default page of a new Textpattern installation:
<txp:article listform="article_listing" limit="5" />
To see this in action, on a new Textpattern install, from the home page click on one of the category links near the bottom (right above the Comment link). Note the URL, similar to<http://example.com/category/meaningful-labor>
. The category
in the URL means this is a listing of articles by category. Here you see only the article title and posting date, because that is what is contained in the form named "article_listing".
Now click on the article title. Note the URL, similar to <http://example.com/articles/1/welcome-to-your-site>
. This is an individual article page. Once again you can see the full article, this time with comments showing.
Continuing from the previous examples:
<txp:article listform="article_listing" limit="5" offset="2" />
limit="5"
) in article list context will begin with the third most recent article published in the site. (The offset will not be applied in individual article context.)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>
Another:
<txp:article limit="5" pageby="10" />
<txp:article limit="5" offset="5" pageby="10" />
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. - From Alex's original forum post.
This code will display articles that have a custom field named "colour" with a value "red":
<txp:article colour="red" />
<txp:article sort="AuthorID asc, Posted desc" />
sort
attribute to define values by which to order article output. In this case two values are declared. AuthorID asc first orders articles alphabetically by author names, then Posted desc orders them by date published ("desc" meaning newest to oldest).wraptag
and break
attributes added.
<txp:article_custom />
The article_custom tag is a single or a container tag that provides a variety of custom options for sorting, selecting, and displaying articles (the tag will be replaced with one or more articles).
If used as a container, it must be specified as an opening and closing pair of tags, like this:
<txp:article_custom> ...contained statements... </txp:article_custom>
This is equivalent to putting the contained statements into a form named "my_form" and using <txp:article_custom form="my_form" />
.
Unlike the article tag, article_custom will always return an article list and is not context-sensitive. This means while the article tag can only see posts within the currently viewed section/category/author and so forth, article_custom can see all posts from all sections, categories and authors unless you restrict it via attributes (see below), thus context-sensitive navigation tags, such as older and newer, will not work.
A comparison of how article and article_custom differ.
Tag will accept the following attributes (case-sensitive):
y
(yes, return only those containing an excerpt).live
or sticky
.live
.past
, future
, or any
(both past
and future
).past
.0
(don't include expired articles) or 1
(include expired articles).ID
(article id#)AuthorID
(author)LastMod
(date last modified)LastModID
(author of last modification)Posted
(date posted)Expires
(expiry date)Title
Category1
Category2
comments_count
Status
Section
Keywords
Image
(article image id#)url_title
custom_1
through custom_10
custom_n
)(custom_n+0)
"rand()
(random). Posted desc
.0
.10
.0
(no) or 1
(yes).0
.default
.These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
labeltag="h3"
)wraptag="ul"
)wraptag
attribute value.break="li"
) or some string to separate list items.br
(but see break cross-reference for exceptions).<txp:article_custom form="month_list" sort="Section asc" month="2004-10" />
<txp:article_custom sort="Posted desc" keywords="One" />
<txp:article_custom form="author_list" author="Parkling" />
the author_list article form might go thus.
<p><txp:permlink><txp:title /></txp:permlink></p>
Other tags used: permlink, title
The following is exactly equivalent to Example 3:
<txp:article_custom author="Parkling"> <p><txp:permlink><txp:title /></txp:permlink></p> </txp:article_custom>
This code will display articles that have a custom field named "colour" with a value "red":
<txp:article_custom colour="red" />
<txp:article_custom sort="AuthorID asc, Posted asc" />
sort
attribute to define values by which to order article output. In this case two values are declared. AuthorID asc first orders articles alphabetically by author names, then Posted desc orders them by date published ("desc" meaning newest to oldest).<txp:article_custom id="81,73" />
<txp:article_custom id="81,73" sort="field(id,81,73)" />
expired
attribute.id
can take a comma-separated list of IDs.wraptag
and break
attributes added.listform
deprecated (it never made a difference to article_custom anyway)sort
added (replaces sortby
and sortdir
)sortby
and sortdir
deprecated
<txp:article_id />
The article_id tag is a single tag which returns the numeric ID of the article being displayed. This number will also be reflected as a part of the article permanent URL if it has been chosen as the Permanent link mode in the Basic Preferences tab.
This tag has no attributes.
<txp:permlink><txp:article_id /></txp:permlink>
Other tags used: permlink
This will only display the hyperlinked article ID when on an individual article page.
<txp:if_individual_article> Article ID: <txp:permlink><txp:article_id /></txp:permlink> </txp:if_individual_article>
Other tags used: if_individual_article, permlink
<txp:article_image />
The article_image tag is a single tag. Textpattern will replace this tag with <img src="..." />
HTML tag(s) matching the numeric ID(s) or URL assigned when the article is posted.
The image to be associated with the tag is set under the Write panel. Click "Article Image" and enter either the URL of the image, or the Textpattern ID (a number set by Textpattern at upload) into the Article image field. Most of the time you will use the image ID or a comma-separated list of IDs here.
Tag will accept the following attributes (case-sensitive):
class
attribute to apply to the image (or to the wraptag, if set).<
, >
and &
for the image's alt
and title
attributes.html
or unset.html
.height="0"
to turn off the output of a width attribute in the <img>
tag (thus the browser will scale the height if a width is used)id
attribute assigned to the image (or to the wraptag, if set).1
(yes) or 0
(no).0
.width="0"
to turn off the output of a width attribute in the <img>
tag (thus the browser will scale the width if a height is used)img
tag, specified without brackets.<txp:article_image wraptag="p" class="article-image" />
<p class="article-image"><img src="..." /></p>
.img
tagUsed in an article list form this will display an article list consisting of hyperlinked article images' thumbnails.
<txp:permlink><txp:article_image thumbnail="1" /></txp:permlink>
Other tags used: permlink
width
and height
attributes addedalign
deprecatedescape
changed from unset to html
class
, escape
, html_id
, thumbnail
, and wraptag
added.
Article Tags are a subcategory of the Tag Reference. They are tags that represent a field in the textpattern table and show or otherwise reference the 'article' content type. See the Articles page.
Download Category:Article_Tags book
<txp:article_url_title />
The article_url_title tag is a single tag which returns the dumbed-down "URL title" of the article being displayed. This URL title may also be part of the page's address depending on the Permanent link mode chosen in Basic Preferences.
This tag has no attributes.
<txp:author />
The author tag is a single tag that is used to return the name of the author of the currently displayed article.
Tag will accept the following attributes (case-sensitive):
0
(no) or 1
(yes).0
.0
(no) or 1
(yes).0
.The author's name in this article form is a hyperlink to a list of articles by this author.
<h1><txp:title /></h1> <txp:body /> <p class="author-date"> Posted By: <txp:author link="1" /> @ <txp:posted /> </p>
Other tags used: posted, title, body
Display the author's name above a list of articles by that author when visiting site.com/author/Author+Name
URLs.
<txp:if_author> <h1>Articles by author: <txp:author /></h1> <txp:article form="article_listing" limit="5" /> </txp:if_author>
Other tags used: if_author, article
title
attribute.section
, this_section
added.
<txp:author_email />
The author_email tag is a single tag that is used to return the email address of the author of the currently displayed article.
Tag will accept the following attributes (case-sensitive):
html
0
(no) or 1
(yes).0
.<txp:author_email />
<txp:author_email link="1" />
<txp:body />
The body tag is a single tag which is used to return the text, or content, of the article being displayed (the article itself). The tag can be used in an article Form, or within Pages (templates), either wrapped within a given article tag, or directly in the template itself so long as the context is with a single article (as opposed to an article list).
This tag has no attributes.
<h3><txp:title /></h3> <div class="post"> <p><txp:author /> @ <txp:posted /></p> <txp:body /> </div>
When used as part of your article form, this displays the article title, author and posted date, then the body text beneath that.
Other tags used: author, posted, title
<txp:breadcrumb />
The breadcrumb tag is a single tag which is used to create breadcrumb navigation. It provides either hyperlinked navigation, or plain text positional display, any time you are not on the Home page.
Tag will accept the following attributes (case-sensitive):
1
(yes) or 0
(no).1
. »
.1
(yes) or 0
(no, display name).0
.These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
wraptag="ul"
)wraptag
attribute value.<txp:breadcrumb label="Navigation" separator="::" link="1" wraptag="p" />
Provides hyperlinks to sections or categories in a breadcrumb style, linking back to your home page.
<txp:breadcrumb label="Navigation" separator=":" link="0" wraptag="p" />
Provides a breadcrumb guide that reflects where a user is within the site's navigation.
sep
attribute deprecated and renamed separator
noline
for linkclass removed, now unset.
<txp:category />
The category tag can be used as either a single or containing tag. It will display information of the category as defined by the name
attribute, or the one currently being viewed. When used as a containing tag, it will turn the contents into a link to the category. Otherwise, it will return plain text.
May be used in any context.
Tag will accept the following attributes (case-sensitive):
wraptag
. If no wraptag is supplied (and link="1"
), the class is applied to the anchor instead.1
(yes) or 0
(no).0
.section
attribute overrides this setting.1
(yes) or 0
(no).0
.1
(yes) or 0
(no, display name).0
.article
, image
, link
, file
.article
.1
(yes) or 0
(no).0
(display title or full link, depending on link
)<txp:category />
<txp:category title="1" link="1" />
<txp:category name="articles" title="1" link="1" wraptag="p" />
<txp:category name="book">My books</txp:category>
class
attribute to the <a>
element when wraptag
is empty.url
to output URL only.this_section
added.
<txp:category_list />
The category_list tag can be used as either a single tag or container tag which is used to produce a list of linked categories.
Tag will accept the following attributes (case-sensitive):
form
attribute. For setting an active class in the container tag see example 3.)sort
attribute). Use category names not Titles here -- note that Textpattern automatically converts the names to lower case and converts spaces to hyphens when they are created0
(no children, i.e. only show one level below the parent) or 1
(all nested categories).1
categories
takes precendence over exclude
.id
name
type
parent
title
rand()
(random)name asc
.section
attribute).0
(no) or 1
(yes).0
. article
, image
, link
, file
.article
.These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
labeltag="h3"
)wraptag="ul"
)wraptag
attribute value.break="li"
) or some string to separate list items.br
(but see break cross-reference for exceptions).<txp:category_list label="Categories" wraptag="p" break="br" />
<txp:category_list break="li" wraptag="ul" />
Styles could go this way
.category_list { list-style-type:none; }
This code will add class="active"
to the <li>
element around the "current" category in the list.
<txp:category_list wraptag="ul" break=""> <li<txp:if_category name='<txp:category />'> class="active"</txp:if_category>> <txp:category title="1" link="1" /> </li> </txp:category_list>
form
and children
attributes added.active_class
, categories
, exclude
, section
, this_section
added.
<txp:category1 />
The category1 tag can be used as either a single tag or container tag. It will display information of the category as defined by Cat1 of the article being displayed. When used as a containing tag, it will turn the contents into a link to that category. Otherwise, it will return plain text.
This tag may be used within either an article form, or in a page, wrapped in an if_individual_article conditional tag.
Tag will accept the following attributes (case-sensitive):
wraptag
.1
(yes) or 0
(no).0
.1
(yes) or 0
(no, output name).0
.1
(yes) or 0
(no, allow from any section).0
.<txp:category1 />
<txp:category1 link="1" title="1" />
If category1 is "General", this tag will display the word "General" as a hyperlink to a list of articles in the same category.
<txp:category1>Other articles in category <txp:category1 title="1" /></txp:category1>
class
, section
, this_section
, wraptag
added.
<txp:category2 />
The category2 tag can be used as either a single tag or container tag. It will display information of the category as defined by Cat2 of the article being displayed. When used as a containing tag, it will turn the contents into a link to that category. Otherwise, it will return plain text.
This tag may be used within either an article form, or in a page, wrapped in an if_individual_article conditional tag.
Tag will accept the following attributes (case-sensitive):
wraptag
.1
(yes) or 0
(no).0
.1
(yes) or 0
(no, allow from any section).0
.1
(yes) or 0
(no, output name).0
.<txp:category2 />
<txp:category2 link="1" title="1" />
If category2 is "General", this tag will display the word "General" as a hyperlink to a list of articles in the same category.
<txp:category2>Other articles in category <txp:category2 title="1" /></txp:category2>
Shows a hyperlinked category 1 and also hyperlinked category 2, but only if it is used.
Filed in: <txp:category1 link="1" title="1" /> <txp:if_article_category number="2"> and <txp:category2 link="1" title="1" /> </txp:if_article_category>
Other tags used: category1, if_article_category
class
, section
, this_section
, wraptag
added.
<txp:comment_anchor />
The comment_anchor tag is a single tag which is used to produce an empty anchor tag with an id attribute reflecting the comment ID. Used in the form that renders your comments (the default form is named "comments").
This tag has no attributes.
When the comment number is 000005 you will see:
<a id="c000005"></a>
<txp:comment_email />
The comment_email tag is a single tag which is used to display the commenter's email address, if entered at the time of posting. Used in a comments display form.
This tag has no attributes.
<txp:comment_message /> <p><small><a href="mailto:<txp:comment_email />">Email</a> | <txp:comment_permlink><txp:comment_id /></txp:comment_permlink></small></p>
Other tags used: comment_id, comment_message, comment_permlink
<txp:comment_email_input />
The comment_email_input tag is a single tag which is used to display a text entry field to accept the commenter's email address. Used in the comment input form.
This tag has no attributes.
<table cellpadding="4" cellspacing="0" border="0"> <tr> <td align="right" valign="top"> <txp:text item="name" /> </td> <td valign="top"> <txp:comment_name_input /> </td> <td valign="top" align="left"> <txp:comment_remember /> </td> </tr> <tr> <td align="right" valign="top"> <txp:text item="email" /> </td> <td valign="top" colspan="2"> <txp:comment_email_input /> </td> </tr> <tr> <td align="right" valign="top"> http:// </td> <td valign="top" colspan="2"> <txp:comment_web_input /> </td> </tr> <tr> <td valign="top" align="right"> <txp:text item="message" /> </td> <td valign="top" colspan="2"> <txp:comment_message_input /> </td> </tr> <tr> <td align="right" valign="top"> </td> <td valign="top" align="left"> <txp:comments_help /> </td> <td align="right" valign="top"> <txp:comment_preview /> <txp:comment_submit /> </td> </tr> </table>
Other tags used: comment_message_input, comment_name_input, comment_web_input, comment_preview, comment_remember, comment_submit, comments_help, text
<txp:comment_id />
The comment_id tag is a single tag which is used to display the comment's internal id as assigned by Textpattern at the time of posting. Used in a comments display form.
This tag has no attributes.
<txp:comment_message /> <p><small>— <txp:comment_name /> <txp:comment_time /> <txp:comment_permlink><txp:comment_id /></txp:comment_permlink></small></p>
Other tags used: comment_message, comment_name, comment_permlink, comment_time
<txp:comment_message />
The comment_message tag is a single tag which is used to display the message text, or comment. Used in a comments display form.
This tag has no attributes.
<txp:comment_message /> <p><small>— <txp:comment_name /> <txp:comment_time /> <txp:comment_permlink>#</txp:comment_permlink></small></p>
Other tags used: comment_name, comment_permlink, comment_time
<txp:comment_message_input />
The comment_message_input tag is a single tag which is used to display a text entry field to accept the commenter's message text. Used in the comment input form.
This tag has no attributes.
<table cellpadding="4" cellspacing="0" border="0"> <tr> <td align="right" valign="top"> <txp:text item="name" /> </td> <td valign="top"> <txp:comment_name_input /> </td> <td valign="top" align="left"> <txp:comment_remember /> </td> </tr> <tr> <td align="right" valign="top"> <txp:text item="email" /> </td> <td valign="top" colspan="2"> <txp:comment_email_input /> </td> </tr> <tr> <td align="right" valign="top"> http:// </td> <td valign="top" colspan="2"> <txp:comment_web_input /> </td> </tr> <tr> <td valign="top" align="right"> <txp:text item="message" /> </td> <td valign="top" colspan="2"> <txp:comment_message_input /> </td> </tr> <tr> <td align="right" valign="top"> </td> <td valign="top" align="left"> <txp:comments_help /> </td> <td align="right" valign="top"> <txp:comment_preview /> <txp:comment_submit /> </td> </tr> </table>
Other tags used: comment_email_input, comment_name_input, comment_web_input, comment_preview, comment_remember, comment_submit, comments_help, text
<txp:comment_name />
The comment_name tag is a single tag which is used to display a link using the commenter's name as text. If email address is supplied and allowed to be viewed, an email link is created. Otherwise, if a website is entered, the website URL is used. If neither is supplied, name displays as plain text.
Commenter's name and/or email address can be set as a requirement.
Used in a comments display form.
1
(yes) or 0
(no).1
.<txp:comment_message /> <p><small>— <txp:comment_name /> <txp:comment_time /> <txp:comment_permlink>#</txp:comment_permlink></small></p>
Other tags used: comment_message, comment_permlink, comment_time
<txp:comment_name_input />
The comment_name_input tag is a single tag which is used to display a text entry field to accept the commenter's name. Used in the comment input form.
This tag has no attributes.
<table cellpadding="4" cellspacing="0" border="0"> <tr> <td align="right" valign="top"> <txp:text item="name" /> </td> <td valign="top"> <txp:comment_name_input /> </td> <td valign="top" align="left"> <txp:comment_remember /> </td> </tr> <tr> <td align="right" valign="top"> <txp:text item="email" /> </td> <td valign="top" colspan="2"> <txp:comment_email_input /> </td> </tr> <tr> <td align="right" valign="top"> http:// </td> <td valign="top" colspan="2"> <txp:comment_web_input /> </td> </tr> <tr> <td valign="top" align="right"> <txp:text item="message" /> </td> <td valign="top" colspan="2"> <txp:comment_message_input /> </td> </tr> <tr> <td align="right" valign="top"> </td> <td valign="top" align="left"> <txp:comments_help /> </td> <td align="right" valign="top"> <txp:comment_preview /> <txp:comment_submit /> </td> </tr> </table>
Other tags used: comment_email_input, comment_web_input, comment_preview, comment_remember, comment_submit, comments_help, text
<txp:comment_permlink>
The comment_permlink tag is a container tag which is used to return the permanent link of the article comment being displayed. The container tag wraps the text assigned to the link.
Tag will accept the following attributes (case-sensitive):
1
(yes) or 0
(no).0
.<txp:comment_permlink>#</txp:comment_permlink>
<txp:comment_preview />
The comment_preview tag is a single tag which is used to display a Preview button the user can use to preview the comment text. Used in the comment input form.
This tag has no attributes.
<table cellpadding="4" cellspacing="0" border="0"> <tr> <td align="right" valign="top"> <txp:text item="name" /> </td> <td valign="top"> <txp:comment_name_input /> </td> <td valign="top" align="left"> <txp:comment_remember /> </td> </tr> <tr> <td align="right" valign="top"> <txp:text item="email" /> </td> <td valign="top" colspan="2"> <txp:comment_email_input /> </td> </tr> <tr> <td align="right" valign="top"> http:// </td> <td valign="top" colspan="2"> <txp:comment_web_input /> </td> </tr> <tr> <td valign="top" align="right"> <txp:text item="message" /> </td> <td valign="top" colspan="2"> <txp:comment_message_input /> </td> </tr> <tr> <td align="right" valign="top"> </td> <td valign="top" align="left"> <txp:comments_help /> </td> <td align="right" valign="top"> <txp:comment_preview /> <txp:comment_submit /> </td> </tr> </table>
Other tags used: comment_email_input, comment_name_input, comment_web_input, comment_remember, comment_submit, comments_help, text
<txp:comment_remember />
The comment_remember tag is a single tag which is used to display a check box input field. If checked the users details are remembered by the system the next time they open a comment form. Used in the comment input form.
This tag has no attributes.
<table cellpadding="4" cellspacing="0" border="0"> <tr> <td align="right" valign="top"> <txp:text item="name" /> </td> <td valign="top"> <txp:comment_name_input /> </td> <td valign="top" align="left"> <txp:comment_remember /> </td> </tr> <tr> <td align="right" valign="top"> <txp:text item="email" /> </td> <td valign="top" colspan="2"> <txp:comment_email_input /> </td> </tr> <tr> <td align="right" valign="top"> http:// </td> <td valign="top" colspan="2"> <txp:comment_web_input /> </td> </tr> <tr> <td valign="top" align="right"> <txp:text item="message" /> </td> <td valign="top" colspan="2"> <txp:comment_message_input /> </td> </tr> <tr> <td align="right" valign="top"> </td> <td valign="top" align="left"> <txp:comments_help /> </td> <td align="right" valign="top"> <txp:comment_preview /> <txp:comment_submit /> </td> </tr> </table>
Other tags used: comment_email_input, comment_name_input, comment_web_input, comment_preview, comment_submit, comments_help, text
<txp:comment_submit />
The comment_submit tag is a single tag which is used to display a Submit button. Clicking the Submit button writes the comment information to the database. Used in the comment input form.
This tag has no attributes.
<table cellpadding="4" cellspacing="0" border="0"> <tr> <td align="right" valign="top"> <txp:text item="name" /> </td> <td valign="top"> <txp:comment_name_input /> </td> <td valign="top" align="left"> <txp:comment_remember /> </td> </tr> <tr> <td align="right" valign="top"> <txp:text item="email" /> </td> <td valign="top" colspan="2"> <txp:comment_email_input /> </td> </tr> <tr> <td align="right" valign="top"> http:// </td> <td valign="top" colspan="2"> <txp:comment_web_input /> </td> </tr> <tr> <td valign="top" align="right"> <txp:text item="message" /> </td> <td valign="top" colspan="2"> <txp:comment_message_input /> </td> </tr> <tr> <td align="right" valign="top"> </td> <td valign="top" align="left"> <txp:comments_help /> </td> <td align="right" valign="top"> <txp:comment_preview /> <txp:comment_submit /> </td> </tr> </table>
Other tags used: comment_email_input, comment_name_input, comment_web_input, comment_preview, comment_remember, comments_help, text
Comment Tags are a subcategory of the Tag Reference. They are tags that all relate to the visitor commenting system built into Textpattern. See the Comments page.
Download Category:Comment_Tags book
<txp:comment_time />
The comment_time tag is a single tag which is used to display the time and date the comment was submitted. Used in a comment form.
This tag will accept the following attributes (case-sensitive):
since
.0
(local time) or 1
(GMT).0
.<txp:comment_message /> <p><small>— <txp:comment_name /> <txp:comment_time /> <txp:comment_permlink>#</txp:comment_permlink></small></p>
Other tags used: comment_name, comment_message, comment_permlink
<txp:comment_web>
The comment_web tag can be used as either a single or a container tag. It is used to display (a link to) the commenter's web address, if entered at the time of posting.
When used as a container tag, it will turn the contents into a link to that web address. Otherwise, it will return the web address.
Used in a comment form.
This tag has no attributes.
<txp:comment_message /> <p><small>— <a href="<txp:comment_web />"><txp:comment_web /></a> <txp:comment_time /> <txp:comment_permlink>#</txp:comment_permlink></small></p>
Other tags used: comment_name, comment_message, comment_permlink, comment_time
<txp:comment_web>Website</txp:comment_web>
<txp:comment_web_input />
The comment_web_input tag is a single tag which is used to display a text entry field to accept the commenter's domain name. This tag can be used in page or form.
Function assumes http://
for all URLs.
This tag has no attributes.
<table cellpadding="4" cellspacing="0" border="0"> <tr> <td align="right" valign="top"> <txp:text item="name" /> </td> <td valign="top"> <txp:comment_name_input /> </td> <td valign="top" align="left"> <txp:comment_remember /> </td> </tr> <tr> <td align="right" valign="top"> <txp:text item="email" /> </td> <td valign="top" colspan="2"> <txp:comment_email_input /> </td> </tr> <tr> <td align="right" valign="top"> http:// </td> <td valign="top" colspan="2"> <txp:comment_web_input /> </td> </tr> <tr> <td valign="top" align="right"> <txp:text item="message" /> </td> <td valign="top" colspan="2"> <txp:comment_message_input /> </td> </tr> <tr> <td align="right" valign="top"> </td> <td valign="top" align="left"> <txp:comments_help /> </td> <td align="right" valign="top"> <txp:comment_preview /> <txp:comment_submit /> </td> </tr> </table>
Other tags used: comment_email_input, comment_message_input, comment_preview, comment_remember, comment_submit, comments_help, text
<txp:comments />
The comments tag is a single tag which is used to display the comments associated with a particular article. Comments will be displayed for the present individual article as a default, or to the article set by the "id" attribute.
Tag will accept the following attributes (case-sensitive):
li
or div
.break
(when value supplied is a tag).wraptag
.comments
.comments
.0
(no limit).0
.discussid
(comment ID)parentid
(article ID)name
email
web
ip
(IP address)posted
message
rand()
(random)posted asc
.ol
or unset.
Comments for articles can be turned off or on at the author's discretion for any article that is published; by using the following scheme in an article form, you can still have the on/off control over comments while still giving users indication of comment status.
<txp:comments /> <txp:if_comments_allowed> <txp:comments_form /> <txp:else /> <p>Comments are turned off for this article.</p> </txp:if_comments_allowed>
Other tags used: comments_form, if_comments_allowed, else
Tags
<txp:if_comments_allowed> <txp:comments form="lineitem" breakclass="special" break="li" wraptag="ul" /> <txp:comments_form /> </txp:if_comments_allowed>
Form (lineitem) (type: comment)
<small><txp:comment_id /></small>
Styles could go this way
.special { display:list-item; list-style-type:none; }
Other tags used: comment_id, comments_form, if_comments_allowed
<txp:comments_count />
The comments_count tag is a single tag which is used to display the number of comments associated with a particular article.
Though comments_count can be used independently, it is also called by comments_invite to append the comments count to the comments_invite link. Used in an article form.
This tag has no attributes.
But only if any comments are associated with the current article.
<txp:if_comments> <p><txp:comments_invite showcount="0" /> <txp:comments_count /> people have already responded.</p> </txp:if_comments>
Other tags used: comments_invite, if_comments
<txp:comments_error />
The comments_error tag is a single tag which is used to produce the current comments error.
Tag will accept the following attributes (case-sensitive):
br
.wraptag
.comments_error
.<txp:if_comments_error> <txp:comments_error break="li" wraptag="ul" /> </txp:if_comments_error>
Other tags used: if_comments_error
<txp:comments_form />
The comments_form tag is a single tag which is used to display a comment form. Comments will be attached to present individual article as a default, or to the article set by the "id" attribute.
Tag will accept the following attributes (case-sensitive):
wraptag
.comments_form
.Forget
(localised).comment_form
.25
.25
.5
.Preview
(localised).Remember
(localised).1
(yes), 0
(no) or unset
(depends on the previous comment_preview tag).unset
.Submit
(localised).Comments for articles can be turned off or on at the author's discretion for any article that is published; by using the following scheme in an article form, you can still have the on/off control over comments while still giving users indication of comment status.
<txp:if_comments_allowed> <txp:comments_form /> <txp:else /> <p>Comments are turned off for this article.</p> </txp:if_comments_allowed>
Other tags used: if_comments_allowed, else
Using some conditional tags the size of the comment input text area can be changed in the preview.
<txp:if_comments_preview> <txp:comments_preview form="comments" /> <p style="color:red;">This is just a preview of your comment!</p> <txp:comments_form isize="30" msgcols="55" msgrows="5" /> <txp:else /> <txp:if_comments_allowed> <txp:comments_form isize="30" msgcols="55" msgrows="15" /> </txp:else /> <p>Comments are turned off for this article.</p> </txp:if_comments_allowed> </txp:if_comments_preview>
Other tags used: comments_preview, if_comments_allowed, if_comments_preview, else
Tags
<txp:if_comments_allowed> <txp:comments form="lineitem" break="li" wraptag="ul" breakclass="special" /> <txp:comments_form /> </txp:if_comments_allowed>
Form (lineitem) Type(comment)
<small><txp:comment_id /></small>
Styles could go this way
.special { display:list-item; list-style-type:none; }
Other tags used: comment_id, comments, if_comments_allowed
forgetlabel
, previewlabel
, rememberlabel
, and submitlabel
attributesshow_preview
added
<txp:comments_help />
The comments_help tag is a single tag which is used to display a Textile help link. This tag can be used in a page or a form.
This tag has no attributes.
<table cellpadding="4" cellspacing="0" border="0"> <tr> <td align="right" valign="top"> <txp:text item="name" /> </td> <td valign="top"> <txp:comment_name_input /> </td> <td valign="top" align="left"> <txp:comment_remember /> </td> </tr> <tr> <td align="right" valign="top"> <txp:text item="email" /> </td> <td valign="top" colspan="2"> <txp:comment_email_input /> </td> </tr> <tr> <td align="right" valign="top"> http:// </td> <td valign="top" colspan="2"> <txp:comment_web_input /> </td> </tr> <tr> <td valign="top" align="right"> <txp:text item="message" /> </td> <td valign="top" colspan="2"> <txp:comment_message_input /> </td> </tr> <tr> <td align="right" valign="top"> </td> <td valign="top" align="left"> <txp:comments_help /> </td> <td align="right" valign="top"> <txp:comment_preview /> <txp:comment_submit /> </td> </tr> </table>
Other tags used: comment_email_input, comment_name_input, comment_web_input, comment_preview, comment_remember, comment_submit, text
<txp:comments_invite />
The comments_invite tag is a single tag which is used to display a link to an article comment form. Text used for the link will be taken from the invitation field on the "write" screen.
This tag can be used in both Page templates and Forms.
Tag will accept the following attributes (case-sensitive):
wraptag
.comments_invite
.1
(yes), 0
(no).0
.1
(yes), 0
(no).1
.1
(yes), 0
(no).0
.But only if there are any comments associated with the current article.
<txp:if_comments><p><txp:comments_invite /></p></txp:if_comments>
Other tags used: if_comments
<txp:comments_preview />
The comments_preview tag is a single tag which is used to display a preview of a visitor's comment.
Tag will accept the following attributes (case-sensitive):
wraptag
.comments_preview
.comments
.ol
or unset.comments_display
, by default).
Conditional Tags are a subcategory of the Tag Reference. They are tags that are used to take action depending if a condition is met.
Most tags beginning if_...
optionally take the else tag to allow you to take some action if the condition does not meet the given criteria.
Download Category:Conditional_Tags book
<txp:css />
The basic css tag is a single tag and used to output the URL of the style sheet assigned in the Sections tab.
Tag will accept the following attributes (case-sensitive):
link
or url
. Default is url
.format="link"
). Default is screen
.format="link"
). Default is stylesheet
.format="link"
). Default is unset.<head> <txp:css format="link" /> </head>
<head> <txp:css format="link" name="style_name" /> </head>
<head> <txp:css format="link" name="plain" rel="alternate" title="Plain and Simple Style" /> <txp:css format="link" name="glossy" rel="alternate" title="Glossy Style"/> <txp:css format="link" name="print" media="print" /> </head>
n
attribute deprecated and renamed name
format
, media
, rel
, title
added.
<txp:custom_field />
The basic custom_field tag is a single tag and used to display the contents of a custom field.
Custom fields are useful when you need to output content having a consistent structure, usually in context to a particular type of article. Custom fields are defined in Advanced Preferences, and used in the Write panel. There are conditions to be aware of in each case, so be sure to read the following sections, respectively:
Also see the if_custom_field conditional tag, which provides more flexibility and power using custom fields.
Tag will accept the following attributes (case-sensitive):
html
or unsethtml
You might, for example, publish book reviews for which you add the author, the title of the book, the publishing company and the year of publication.
With:
J.R.R. Tolkien
The Lord of the Rings
HarperCollins
2004
and an article form like the following:
<p><txp:custom_field name="Book_Author" />: <txp:custom_field name="Book_Title" /><br /> Published by <txp:custom_field name="Book_Publisher" /> in <txp:custom_field name="Book_Year" />.</p>
HTML returned would be:
<p>J.R.R. Tolkien: The Lord of the Rings<br /> Published by HarperCollins in 2004.</p>
This works well with variation of Sencer's Txp bookmarklet.
With an article title of Textpattern
, an excerpt of Textpattern is awesome.
, a custom field named "Link" containing http://textpattern.com/
, and an article form like the following:
<div class="linklog-entry"> <div style="float: left;"><a href="<txp:custom_field name="Link" />"><txp:title /></a></div> <div style="float: right;"><txp:posted format="%d %d %Y" /></div><br> <txp:excerpt /> </div>
HTML returned would be:
<div class="linklog-entry"> <div style="float: left;"><a href="http://textpattern.com/">Textpattern</a></div> <div style="float: right;"><txp:posted format="08 Aug 2005" /></div> <p>Textpattern is awesome.</p> </div>
Other tags used: title, posted, excerpt
With a custom field named "foo" containing:
<a href="../here/">
using the following:
<txp:custom_field name="foo" />
will return this hunk of HTML:
<a href="../here/">
whereas using:
<txp:custom_field name="foo" escape="" />
will render the URL as you'd expect, exactly as written in the custom field itself. Thus, it will be rendered as a link by the browser.
<txp:else />
The else tag is a single tag that is used within a containing conditional tag to provide the means to assign default, or alternative, behavior when the condition in the surrounding tag is not met.
Visually, this is the general structure in which it is used:
<txp:if_conditional_tag> ...Content if true... <txp:else /> ...Content if not true... </txp:if_conditional_tag>
This tag has no attributes.
<txp:if_excerpt> And Furthermore · <txp:excerpt /> <txp:else /> <txp:section link="1" /> </txp:if_excerpt>
Other tags used: excerpt, if_excerpt, section
<txp:email>
The email tag is both a single tag and a container tag. Textpattern will replace it with a mailto:
email link, according to the attributes set.
Tag will accept the following attributes (case-sensitive):
Contact
.<txp:email email="donald.swain@example.com" linktext="Contact me" title="Send me an Email" />
<txp:email email="donald.swain@example.com?subject=Lorem Ipsum&body=Sit amet" />
<txp:email email="donald.swain@example.com" title="Email me!"><img src="/images/email.gif" /></txp:email>
If you happen to use the "email" glyph in the social media set of Symbolset, you can still use this tag. Let's say you're creating a social button bar using Symbolset glyphs in a list. The normal way to do this would be to set up your selectors on the individual anchor elements, like the first three list items show below. But for the email glyph you need to put the selectors in the li
since you can't put them in the a
, as the last list item shows:
<ul class="socbar"> <li><a href="https://twitter.com/xxx" class="ss-icon twit" title="">twitter</a></li> <li><a href="https://plus.google.com/xxx/posts" class="ss-icon gplus" title="">googleplus</a></li> <li><a href="http://www.linkedin.com/in/xxx" class="ss-icon in" title="Pffft">linkedin</a></li> <li class="ss-icon email"><txp:email email="your@email.tld" linktext="email" title="" /></li> </ul>
If you're using Symbolset, then you'll know that the linktext=""
attribute in the last list item above has to be "email" for the glyph to work.
Then the CSS must be like this to target both instances of selector use...
/* ****** First the common rules */ a.ss-icon, li.ss-icon a { /* design as you want */ } /* ****** Target each one if specific hover effect is wanted. */ .twit:hover { /* design as you want */ } ... etc ... li.email a:hover { /* design as you want */ }
Tip: See the feed_link tag for a similar solution for Symbolset's "rss" glyph.
Error Handling Tags are a subcategory of the Tag Reference. They are tags that allow you to deal with or otherwise intercept/display the result of exceptional circumstances in the page flow.
Download Category:Error_Handling_Tags book
<txp:error_message />
The error_message tag is a single tag that Textpattern will replace with the error message text for the error status as set by the server. Should be used in an error_xxx or error_default page template.
This tag takes no attributes.
<h3><txp:error_status /></h3> <p><txp:error_message /></p>
Other tags used: error_status
<txp:error_status />
The error_status tag is a single tag that Textpattern will replace with the error status as set by the server. Should be used in an error_xxx or error_default page template.
This tag takes no attributes.
<h3><txp:error_status /></h3> <p><txp:error_message /></p>
Other tags used: error_message
<txp:excerpt />
The excerpt tag is a single tag which is used to return the excerpt text, if any, associated with the article being displayed.
This tag has no attributes.
The conditional tag if_excerpt can be used to check if there is an excerpt.
This example explains how you could display the excerpt in an article list, and excerpt + body in an individual article. Use the following in an article form:
<txp:if_article_list> <txp:if_excerpt> <txp:excerpt /> <p class="read-more> <a href="<txp:permlink />#body" title="<txp:title />">» Read more</a> </p> <txp:else /> <txp:body /> </txp:if_excerpt> <txp:else /> <txp:if_excerpt> <txp:excerpt /> </txp:if_excerpt> <div id="body"> <txp:body /> </div> </txp:if_article_list>
Other tags used: body, if_article_list, if_excerpt, permlink, title
Use the following within an article form:
<txp:if_excerpt> <txp:excerpt /> <txp:else /> <p>Section: <txp:section title="1" link="1" /></p> </txp:if_excerpt>
Other tags used: if_excerpt, section
<txp:expires />
A single tag used to indicate when an article should no longer appear in a site, particularly when the information is date sensitive (e.g., events like conferences, meetings and so forth). The tag is defined by expiration date values that are set under the More section of the Write admin-side panel.
For more on this tag see its announcement, So, youâ??d like to stick a â??Best Beforeâ? label on those articles?
Tag will accept the following attributes (case-sensitive):
wraptag
element.since
.0
(local time) or 1
(GMT).0
.<p>Expires: <txp:expires format="%b %d, %Y" /></p>
would result in:
<p>Expires: Sep 10, 2010</p>
Related tags are:
<txp:feed_link>
The feed_link tag can be used as either a single or container tag and is used to output a link to the site's "articles" RSS feed. When used as a container tag, it will turn the contents into a link to the feed, otherwise the value of attribute "label" will be used as link text. Should be used in a page.
Tag will accept the following attributes (case-sensitive):
rss
or atom
.rss
.a
or link
.a
.flavor
used, either RSS feed
or Atom feed
.These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
wraptag="ul"
)wraptag
attribute value.Note: wraptag is applicable only when using format
of a
.
<txp:feed_link flavor="rss" section="about" category="general" label="XML" wraptag="p" />
<txp:feed_link wraptag="p"><img src="/path/to/rss-icon" /></txp:feed_link>
<txp:feed_link section="" category="" />
section
and category
attributes, the feed will default to the current section/category.If you happen to use the "rss" glyph in the social media set of Symbolset, you can still use this tag. Let's say you're creating a social button bar using Symbolset glyphs in a list. The normal way to do this would be to set up your selectors on the individual anchor elements, like the first three list items show below. But for the rss glyph you need to put the selectors in the li
, as the last list item shows:
<ul class="socbar"> <li><a href="https://twitter.com/xxx" class="ss-icon twit" title="">twitter</a></li> <li><a href="https://plus.google.com/xxx/posts" class="ss-icon gplus" title="">googleplus</a></li> <li><a href="http://www.linkedin.com/in/xxx" class="ss-icon in" title="Pffft">linkedin</a></li> <li class="ss-icon rss"><txp:feed_link flavor="rss" section="articles" category="" label="rss" /></li> </ul>
Notes:
label=""
attribute in the last list item above must be "rss" for the glyph to work.class=""
attribute, it won't work, unfortunately. But putting them in the li
element like shown above does.flavor="atom"
and create an atom feed just fine, you still need to use label="rss"
for the link label to call the Symbolset glyph. This shouldn't be a problem because the glyph replaces the link text. You can then use title=""
to provide a custom hover text, or leave it out for the default display: "Atom feed".Then the CSS must be like follows to target both instances of Symbolset glyph use...
/* ****** First the common rules */ a.ss-icon, li.ss-icon a { /* design as you want */ } /* ****** Target each one if specific hover effect is wanted. */ .twit:hover { /* design as you want */ } ... etc ... li.rss a:hover { /* design as you want */ }
Tip: See the email tag for a similar solution for Symbolset's "email" glyph.
class
attribute addedformat
added.
<txp:file_download />
The file_download tag is a single tag which Textpattern will replace with a file download form. Inside that form go the other.
Tag will accept the following attributes (case-sensitive):
files
.<txp:file_download form="files" id="1" />
<txp:text item="file" />: <txp:file_download_link> <txp:file_download_name /> [<txp:file_download_size format="b" decimals="2" />] </txp:file_download_link> <br /> <txp:text item="category" />: <txp:file_download_category /><br /> <txp:text item="download" />: <txp:file_download_downloads />
Other tags used: file_download_category, file_download_downloads, file_download_link, file_download_name, file_download_size, text
<txp:file_download_author />
The file_download_author tag is a single tag that Textpattern will replace with the author's name associated with the current download in a file_download. Can only be used inside <txp:file_download />
.
Tag will accept the following attributes (case-sensitive):
<txp:file_download_category />
The file_download_category tag is a single tag that Textpattern will replace with the category of the file to download. Should be used in a download form.
Tag will accept the following attributes (case-sensitive):
0
(name), or 1
(title).0
.class
attribute to apply to the category wraptag
.<txp:text item="category" />: <txp:file_download_category />
Other tags used: text
<txp:file_download_created />
The file_download_created tag is a single tag that Textpattern will replace with the upload date of the file to download. Should be used in a download form.
Tag will accept the following attributes (case-sensitive):
<txp:file_download_created format="%c" />
<txp:file_download_description />
The file_download_description tag is a single tag which Textpattern will replace with the description of the file to download, as defined when the file was uploaded. Should be used in a download form.
Tag will accept the following attributes (case-sensitive):
<
, >
and &
for the file's description
attribute.html
or unsethtml
.<txp:text item="description" />: <txp:file_download_description />
Other tags used: text
escape
changed from unset to html
<txp:file_download_downloads />
The file_download_downloads tag is a single tag that Textpattern will replace with the number of times the current file has been downloaded. Should be used in a download form.
This tag has no attributes.
<txp:text item="downloads" />: <txp:file_download_downloads /><code>
Other tags used: text
<txp:file_download_id />
The file_download_id> tag is a single tag that Textpattern will replace with the internal ID number of the file to be downloaded. Should be used in a download form.
This tag has no attributes.
<txp:text item="File number" />: <txp:file_download_id />
Other tags used: text
<txp:file_download_link />
The file_download_link tag is both a single tag and a container tag. Thus it may be used as an opening and closing pair:
<txp:file_download_link> ...containing statements... </txp:file_download_link>
When used as a single tag, Textpattern will replace the tag with a download link to the file being downloaded. As a container, it will assign the link to the given text or tag, while the single tag outputs the file's plain URL.
Tag will accept the following attributes (case-sensitive):
<txp:file_download_link id="4"> <txp:file_download_name /> [<txp:file_download_size format="mb" decimals="2" />] </txp:file_download_link>
Other tags used:
This example is based on a real situation where a PDF file was made available as a language translation of the main article. This was a viableâ??and low-techâ??solution to a problem where full integration of the MLP pack was not feasible for the website owner's needs and abilities.
<txp:if_custom_field name="PDF translation"> <txp:file_download_link id='<txp:custom_field name="PDF translation" />'> <txp:file_download_name title="1" /> [PDF, <txp:file_download_size format="b" decimals="1" />] </txp:file_download_link> </txp:if_custom_field>
Other tags used:
<txp:file_download_list />
The file_download_list tag is a single or a container tag which is used to produce a list of download links according to the given attributes. Each file in the list is formatted by the file tags used in the given form (default is the files
form).
If used as a container, it must be specified as an opening and closing pair of tags, like this:
<txp:file_download_list> ...contained statements... </txp:file_download_list>
Tag will accept the following attributes (case-sensitive):
files
.10
.limit
"limit
attribute. Use pageby="limit"
to do this, which means you will not have to amend two values if you subsequently decide to alter the limit
id
filename
title
category
description
downloads
created
modified
rand()
(random). asc
or desc
orders by ascending or descending value, respectively.filename asc
.hidden
, pending
, live
.live
.These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
labeltag="h3"
)wraptag="ul"
)wraptag
attribute value.break="li"
) or some string to separate list items.br
(but see break cross-reference for exceptions).<txp:file_download_list limit="10" break="li" wraptag="ul" sort="downloads desc" />
Styles could go this way
.file_download_list { list-style-type:none; }
pageby
attribute added to enable paging via newer and olderauthor
and realname
attributes addedauto_detect
added to allow automatic (URL-based) contextual listingsid
.
<txp:file_download_modified />
The [[file_download_modified]> tag is a single tag that Textpattern will replace with the last modified date of the file to download. Should be used in a download form.
Tag will accept the following attributes (case-sensitive):
<txp:file_download_modified format="%c" />
<txp:file_download_name />
The file_download_name> tag is a single tag that Textpattern will replace with the name of the file to download. Should be used in a download form or within a file_download_link tag.
Tag will accept the following attributes (case-sensitive):
0
(name), or 1
(title).0
.<txp:file_download_link filename="my_presentation.pdf"> <txp:file_download_name /> [<txp:file_download_size format="mb" decimals="2" />] </txp:file_download_link>
Other tags used: file_download_link, file_download_size
title
attribute added
<txp:file_download_size />
The file_download_size tag is a single tag which Textpattern will replace with the formatted file size of the file to be downloaded. Should be used in a download form.
Tag will accept the following attributes (case-sensitive):
2
.<txp:file_download_size format="k" />
File Tags are a subcategory of the Tag Reference. They are tags that are used to display files that are managed through the Files Tab.
Download Category:File_Tags book
Tags listed here are not yet in use, but are under development and anticipated for future Textpattern releases. See Tags In Development for more details.
Download Category:Future_Tags book
<txp:hide>
The hide tag is a container tag which is used to suppress the interpretation of all enclosed contents. Use it for comments, temporary concealment of article text parts or non-destructive form changes.
This tag has no attributes.
<txp:hide>This is essential as a work-around for the Peekaboo bug in Internet Explorer 6</txp:hide>
If you want to try something out to see how it affects the layout without actually deleting the content, wrap it in hide tags:
<div class="entry-content"> <txp:body /> </div> <txp:hide> <address class="vcard author"> — <span class="fn"><txp:author /></span> </address> <txp:comments_invite wraptag="p" /> </txp:hide>
entry-content
div but skips the address
and comments_invite
tags.Other tags used: body, author, comments_invite
<txp:if_article_author>
The if_article_author tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_article_author> ...conditional statement... </txp:if_article_author>
The tag will execute the contained statement if the author name associated with a particular article matches the value of the name attribute. Should be used in an article form.
Tag will accept the following attributes (case-sensitive):
<txp:if_article_author name="admin"> <p>Publisher</p> </txp:if_article_author>
<txp:if_article_category>
The if_article_category tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_article_category> ...conditional statement... </txp:if_article_category>
It will execute the contained statement if the category name associated with a particular article (Category1 or Category2) matches the values of the name and number attributes. Should be used in an article form.
Tag will accept the following attributes (case-sensitive):
1
or 2
<txp:if_article_category name="prose" number="1"> <p><txp:category1 /></p> </txp:if_article_category>
Other tags used: category1
<txp:if_article_category name="prose" number="1"> <p>Fun With Prose</p> <txp:else /> <p><a href="index.php">Home</a></p> </txp:if_article_category>
Other tags used: else
In an article form, put the following set of conditionals for each category you want to look for:
<txp:if_article_category name="yourcategory" number="1"> <ul> <txp:article_custom form="sub" category="yourcategory" sortby="Posted" sortdir="asc" /> </ul> </txp:if_article_category>
And then your article form (in this case called 'sub') can be used to list links to other articles like this:
<li><txp:permlink><txp:title /></txp:permlink></li>
Other tags used: article_custom, else, title, permlink
<txp:if_article_id>
The if_article_id tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_article_id> ...conditional statement... </txp:if_article_id>
The tag will execute the contained statement if the article id associated with a particular article matches the id attribute. Should be used in an article form/container. The id
attribute must be used in an article list context (when producing a page that displays more than one article) or the tag will do nothing.
Tag will accept the following attributes (case-sensitive):
<txp:if_article_id id="33"> <p><txp:title /></p> </txp:if_article_id>
Other tags used: title
<txp:article_custom label="related" labeltag="h4" section='<txp:section />' wraptag="ul"> <txp:if_article_id> <txp:else /> <li><txp:permlink><txp:title /></txp:permlink></li> </txp:if_article_id> </txp:article_custom>
Other tags used: article custom, section, else, permlink, title
id
attribute.
<txp:if_article_image>
The if_article_image tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_article_image> ...conditional statement... </txp:if_article_image>
The tag will execute the contained statements if an image is associated (through the article image field) with the article being displayed.
This tag has no attributes.
<txp:if_article_image> <txp:article_image /> <txp:else /> <txp:image id="5" /> </txp:if_article_image>
Other tags used: article_image, else, image
<txp:if_article_list>
The if_article_list tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_article_list> ...conditional statement... </txp:if_article_list>
The tag will execute the contained statement if an article list is being displayed (i.e. not showing an individual article).
This tag has no attributes.
This example shows how to setup article navigation so that prev-next is used at the individual article level or older-newer with article lists.
<txp:article /> <txp:if_individual_article> <p> <txp:link_to_prev><txp:prev_title /></txp:link_to_prev> <txp:link_to_next><txp:next_title /></txp:link_to_next> </p> </txp:if_individual_article> <txp:if_article_list> <p> <txp:older>Previous</txp:older> <txp:newer>Next</txp:newer> </p> </txp:if_article_list>
Other tags used: link_to_prev, link_to_next, prev_title, next_title, if_individual_article, older, newer,
This example shows the if_article_list in combination with else to display a site's site_name or logo when an article list is displayed or not, respectively.
<txp:if_article_list> <p><txp:site_name /></p> <txp:else /> <p><img src="http://yoursite/yourlogo.jpg"></img></p> </txp:if_article_list>
Other tags used: else, site_name
<txp:if_article_section>
The if_article_section tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_article_section> ...conditional statement... </txp:if_article_section>
The tag will execute the contained statements if the section name associated with a particular article matches the value of the name
attribute. Should be used in an article form.
Tag will accept the following attributes (case-sensitive):
<txp:if_article_section name="poetry"> <p>by <txp:author /></p> </txp:if_article_section>
Poetry
.Other tags used: author
<txp:if_article_section name="poetry"> <p>Fun With Poetry</p> <txp:else /> <p><a href="index.php">Home</a></p> </txp:if_article_section>
Poetry
, or shows a default link otherwise.Other tags used: else
<txp:if_author>
The if_author tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_author> ...conditional statement... </txp:if_author>
The tag will execute the contained statement if the called page is the result of an article search by a specific author's name.
Tag will accept the following attributes (case-sensitive):
article
Selects a stylesheet named "author_list" when a list by author "admin" is being displayed, or a stylesheet determined by the active section for normal page display.
<txp:if_author name="admin"> <link rel="stylesheet" href="<txp:css name="author_list" />" type="text/css" /> <txp:else /> <link rel="stylesheet" href="<txp:css />" type="text/css" /> </txp:if_author>
type
attribute added
<txp:if_category>
The if_category tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_category> ...conditional statement... </txp:if_category>
The tag will execute the contained statements if the name
attribute matches a category search value, or the list is an article list by category (?c=category
)
Should be used in a page template; if checking the category in an article form, use if_article_category.
Tag will accept the following attributes (case-sensitive):
article
<txp:if_category name="prose"> <p><txp:author /></p> </txp:if_category>
Other tags used: author
<txp:if_category name="prose"> <p><txp:category /></p> <txp:else /> <h3><txp:site_name /></h3> </txp:if_category>
Other tags used: category, else, site_name
<txp:if_category> <h3>Articles in category <txp:category title=1 />:</h3> <txp:else /> <h3>All articles:</h3> </txp:if_category>
Other tags used: category, else
Given the defined article categories: Prose, Poetry, and Opinions.
<txp:category_list label="Category Navigation" wraptag="p" class="list" /> <txp:if_category name="prose"> <txp:recent_articles label="Prose" limit="25" break="br" wraptag="p" class="list" category="prose" /> </txp:if_category> <txp:if_category name="poetry"> <txp:recent_articles label="Poetry" limit="25" break="br" wraptag="p" class="list" category="poetry" /> </txp:if_category> <txp:if_category name="opinions"> <txp:recent_articles label="Opinions" limit="25" break="br" wraptag="p" class="list" category="opinions" /> </txp:if_category>
Styles could go this way:
p.list { font-family: Verdana, "Lucida Grande", Tahoma, Helvetica; font-size: 11px; color:#333; margin-left: 10px; border-left: 3px solid #ccc; } p.list a { color:#333; margin-left:15px; } p.list a:hover } border-bottom: 1px dashed #333; }
Other tags used: category_list, recent_articles
type
attribute added
<txp:if_comments>
The if_comments tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_comments> ...conditional statement... </txp:if_comments>
The tag will execute the contained statements if there are one or more comments associated with a particular article. Should be used in an article form.
This tag has no attributes.
<txp:if_comments> <p><txp:comments_count /> Comments</p> <txp:else /> <p>No Current Comments</p> </txp:if_comments>
Other tags used: comments_count, else
<txp:if_comments_allowed>
The if_comments_allowed tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_comments_allowed> ...conditional statement... </txp:if_comments_allowed>
The tag will execute the contained statements if comments are allowed for a given article.
This tag can be used in pages, or in article or comment forms; though it will allow you to use an id attribute in a comment form, the default behavior (no attribute) will ensure consistency in comment/article matching when viewing an individual article.
When used in a page template, it will test the article identified by the attribute for status and act, or not, according to that status. It will not pass the id attribute to the contained statement, such as comments or comments_form, they must be added as attributes to the contained tag.
This tag is mainly used in combination with if_comments_disallowed.
This tag has no attributes.
Comments for articles can be turned off or on at the author's discretion for any article that is published; by using the following scheme in an article form, you can still have the on/off control over comments while also giving an indication of the comment status.
<txp:if_comments_allowed> <txp:comments_form /> </txp:if_comments_allowed> <txp:if_comments_disallowed> <p>Comments are turned off for this article.</p> </txp:if_comments_disallowed>
Other tags used: comments_form, if_comments_disallowed
<txp:if_comments_allowed> <txp:comments form="lineitem" break="li" wraptag="ul" breakclass="special" /> <txp:else /> <p>Comments closed</p> </txp:if_comments_allowed>
Form (lineitem) (type: comment)
<txp:comment_id />
Styles could go this way
.special { display:list-item; list-style-type:none; }
Other tags used: comments, else, comment_id
<txp:if_comments_disallowed>
The if_comments_disallowed tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_comments_disallowed> ...conditional statement... </txp:if_comments_disallowed>
The tag will execute the contained statements if comments are disallowed for a given article.
The if_comments_disallowed tag can be used in pages, and in article and comment forms. When used in a page template, it will test the article identified by the attribute for status and act, or not, according to that status. It will not pass the id
attribute to the contained statement, such as comments or comments_form; they must be added as attributes to the contained tag.
Although you can use an id
attribute in a comment form, the default behavior (no attribute) will ensure consistency in comment/article matching when viewing an individual article.
This tag is mainly used in combination with if_comments_allowed.
This tag has no attributes.
Comments for articles can be turned off or on at the authors discretion for any article that is published; by using the following scheme in an article form, you can still have the on/off control over comments while still giving users indication of comment status.
<txp:if_comments_allowed> <txp:comments_form /> </txp:if_comments_allowed> <txp:if_comments_disallowed> <p>Comments are turned off for this article.</p> </txp:if_comments_disallowed>
Other tags used: if_comments_allowed, comments_form
<txp:if_comments_disallowed> <txp:comments form="lineitem" break="li" wraptag="ul" breakclass="special" /> </txp:if_comments_disallowed>
Form (lineitem) (type: comment)
<small><txp:comment_permlink><txp:comment_id /></txp:comment_permlink></small>
Styles could go this way
.special { display:list-item; list-style-type:none; }
Other tags used: comments, comment_permlink, comment_id
<txp:if_comments_error>
The if_comments_error tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_comments_error> ...conditional statement... </txp:if_comments_error>
The tag will execute the contained statements when an error exists with the comments.
This tag has no attributes:
<txp:if_comments_error> <txp:comments_error /> </txp:if_comments_error>
Other tags used: comments_error
<txp:if_comments_preview>
The if_comments_preview tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_comments_preview> ...conditional statement... </txp:if_comments_preview>
The tag will execute the contained statements if a comment is being previewed.
This tag takes no attributes:
<txp:if_comments_preview> <p>Please review your comment before submitting</p> </txp:if_comments_preview>
<txp:if_custom_field>
The if_custom_field tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_custom_field> ...conditional statement... </txp:if_custom_field>
The tag will execute the contained statements if one or more custom fields for a given article have content. The contents of a custom field can be displayed with the custom_field tag.
Tag will accept the following attributes (case-sensitive):
exact
: value text must exactly match the custom fieldany
: checks if any of the given comma-separated list of values occur anywhere in the custom fieldall
: checks if all of the given comma-separated list of values occur anywhere in the custom fieldpattern
: allows you to specify a regular expression in your value attribute to match against the custom field<txp:if_custom_field name="subtitle"> <txp:custom_field name="subtitle" /> </txp:if_custom_field>
The whole set of custom fields could look like this:
<p><txp:custom_field name="author" />: <txp:custom_field name="title" /> <br /> <txp:if_custom_field name="subtitle"> <txp:custom_field name="subtitle" /><br /> </txp:if_custom_field> published by <txp:custom_field name="publisher" /> in <txp:custom_field name="year" />.</p>
For a book that has a subtitle, this may be seen:
<p>Stephen Covey: The Seven Habits of Highly Effective People<br /> Powerful Lessons in Personal Change<br /> published by Simon & Schuster in 2002.</p>
For a book without a subtitle, this might be shown:
<p>J.R.R. Tolkien: The Lord of the Rings<br /> published by HarperCollins in 2004.</p>
Other tags used: custom_field
A mood indicator:
<txp:if_custom_field name="mood" value="happy"> <img src="/images/happy-face.gif" alt="" /> </txp:if_custom_field> <txp:if_custom_field name="mood" value="sad"> <img src="/images/sad-face.gif" alt="" /> </txp:if_custom_field>
mood
to see if it matches the text "happy" or "sad". Depending which one it matches determines which of the emoticons is displayed.<txp:if_custom_field name="website"> <txp:custom_field name="website" /> <txp:else /> <p>Unfortunately, this band hasn't got a website.</p> </txp:if_custom_field>
Other tags used: custom_field, else
<txp:if_custom_field name="animals" separator="," match="any" value="monkeys"> <p>The monkeys are eating bananas.</p> <txp:else /> <p>The bears ate all the monkeys. How sad.</p> </txp:if_custom_field>
animals
which has a comma separated list of animals. It checks if it contains the text "monkeys", and displays a conditional statement if it does.Other tags used: else
val
deprecated and renamed to value
match
and separator
attributes
<txp:if_different>
The if_different tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_different> ...conditional statement with <txp:other_tag>... </txp:if_different>
The tag will execute the contained statement when the value of the contained statement differs from the preceding value for that contained statement. Can be used in article, link, comment, and file forms.
if_different can contain several HTML tags but only one Textpattern tag.
You can work around this limitation by means of the use of the variable and if_variable tags.
This tag has no attributes.
<txp:if_different> <h3><txp:posted format="%d %B %Y" /></h3> </txp:if_different>
To be used inside an article form or an article tag container.
Other tags used: posted
Intention:
Desired result:
In a page template, add this tag to loop through all articles from all sections:
<txp:article_custom sort="section ASC, Title ASC" form="tree" />
The contents of the tree
form used by the snippet above lists all article titles and renders an intermittent heading element whenever a different section is encountered while the articles loop through:
<txp:if_different><h2><txp:section title="1" /></h2></txp:if_different> <txp:title />
Other tags used: article_custom, section, title
<txp:if_excerpt>
The if_excerpt tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_excerpt> ...conditional statement... </txp:if_excerpt>
The tag will execute the contained statements if an excerpt is associated with the article being displayed.
This tag has no attributes.
<txp:if_excerpt> <txp:excerpt /> <txp:else /> Section <a href="/subdirname/index.php?s=<txp:section />"><txp:section /></a> </txp:if_excerpt>
If there is no excerpt associated with the current article, the section name linked as /"subdirname/index.php?s=section_name" will be displayed instead, providing a means of displaying the articles from the same section as the current article.
Other tags used: excerpt, else, section
<txp:if_expired>
The if_expired tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_expired> ...conditional statement... </txp:if_expired>
The tag will execute the contained statements, if a particular article is expired. Should be used in an article form.
For more on this tag see its announcement, So, youâ??d like to stick a â??Best Beforeâ? label on those articles?
None.
<txp:if_expired> This article is already expired. It expired <txp:expires />. <txp:else /> This page isn't expired. It expires <txp:expires />. </txp:if_expired>
Other tags used: expires
Related tags are:
<txp:if_expires>
The if_expires tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_expires> ...conditional statement... </txp:if_expires>
The tag will execute the contained statements, if a particular article has an expiry date set. Should be used in an article form.
For more on this tag see its announcement, So, youâ??d like to stick a â??Best Beforeâ? label on those articles?
None.
<txp:if_expires> This article expires on <txp:expires />. </txp:if_expires>
Other tags used: expires
Related tags are:
<txp:if_first_article>
The if_first_article tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_first_article> ...conditional statement... </txp:if_first_article>
The tag will execute the contained statements if the displayed article is the first in the currently displayed list. It will display in both single article and article list modes. Should be used in an article form.
This tag has no attributes.
<h3><txp:permlink><txp:title /></txp:permlink> · <txp:posted /> by <txp:author /> <txp:if_first_article> · Section: <txp:section link="1" title="1" /> </txp:if_first_article></h3> <txp:body /> <txp:comments_invite wraptag="p" />
Other tags used: permlink, title, author, posted, section, body, comments_invite
<li <txp:if_first_article>class="first"</txp:if_first_article>><a title="<txp:title />" href="<txp:permlink />"><txp:title /></a></li>
Other tags used: permlink, title
<txp:if_first_category>
The if_first_category tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_first_category> ...conditional statements... </txp:if_first_category>
The tag will execute the contained statements if the current category (usually one inside the container or form of a category_list) is the first in the currently displayed list.
This tag has no attributes.
<txp:category_list parent="group-1" children="0"> <txp:if_first_category> <h3><txp:category /></h3> <txp:else /> <txp:category link="1" /> </txp:if_first_category> </txp:category_list>
Other tags used: category_list, category, else
<txp:if_first_section>
The if_first_section tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_first_section> ...conditional statements... </txp:if_first_section>
The tag will execute the contained statements if the current section (usually one inside the container or form of a section_list) is the first in the currently displayed list.
This tag has no attributes.
<txp:section_list wraptag="ul" break=""> <li<txp:if_first_section> id="first"</txp:if_first_section>><txp:section title="1" link="1" /></li> </txp:section_list>
<txp:if_individual_article>
The if_individual_article tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_individual_article> ...conditional statement... </txp:if_individual_article>
The tag will execute the contained statements if an individual article is being displayed (i.e. not an article list).
Please note, that article_custom always displays an article list, even when you set it to display only one article. Thus the if_individual_article tag will not work with article_custom, you'll have to use the article tag instead.
This tag has no attributes.
<txp:article /> <txp:if_individual_article> <p> <txp:link_to_prev><txp:prev_title /></txp:link_to_prev> <txp:link_to_next><txp:next_title /></txp:link_to_next> </p> </txp:if_individual_article> <txp:if_article_list> <p> <txp:older>Previous</txp:older> <txp:newer>Next</txp:newer> </p> </txp:if_article_list>
Other tags used: link_to_prev, link_to_next, next_title, prev_title, if_article_list, older, newer
<txp:if_individual_article> <p><txp:site_name /></p> <txp:else /> <p><img src="http://yoursite/yourlogo.jpg"></img></p> </txp:if_individual_article>
Other tags used: else, site_name
<txp:if_keywords>
The if_keywords tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_keywords> ...conditional statements... </txp:if_keywords>
The tag will execute the contained statement if the current article's keywords field has one or more entries.
Tag will accept the following attributes (case-sensitive):
<head> [...] <txp:if_individual_article> <txp:if_keywords> <meta name="keywords" content="<txp:keywords />" /> <txp:else /> <meta name="keywords" content="apple, orange, pear, foo, bar" /> </txp:if_keywords> <txp:else /> <meta name="keywords" content="apple, orange, pear, foo, bar" /> </txp:if_individual_article> [...] </head>
Other tags used: keywords, if_individual_article, else
<txp:if_last_article>
The if_last_article tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_last_article> ...conditional statement... </txp:if_last_article>
The tag will execute the contained statements if the displayed article is the last in the currently displayed list. It will display in both single article and article list modes. Should be used in an article form.
This tag has no attributes.
<h3><txp:permlink><txp:title /></txp:permlink> · <txp:posted /> by <txp:author /></h3> <txp:body /> <txp:comments_invite wraptag="p" /> <txp:if_last_article> <img src="/images/footer.jpg" /> </txp:if_last_article>
Other tags used: permlink, title, posted, author, body, comments_invite
<txp:if_last_category>
The if_last_category tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_last_category> ...conditional statements... </txp:if_last_category>
The tag will execute the contained statements if the current category (usually one inside the container or form of a category_list) is the last in the currently displayed list.
This tag has no attributes.
TBW
<txp:if_last_section>
The if_last_section tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_last_section> ...conditional statements... </txp:if_last_section>
The tag will execute the contained statements if the current section (usually one inside the container or form of a section_list) is the last in the currently displayed list.
This tag has no attributes.
<txp:section_list wraptag="ul" break=""> <li<txp:if_last_section> id="last"</txp:if_last_section>><txp:section title="1" link="1" /></li> </txp:section_list>
<txp:if_plugin>
The if_plugin tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_plugin> ...conditional statement... </txp:if_plugin>
The tag will execute the contained statements if the name attribute matches a currently installed and enabled plugin, and the current version number is equal to or greater than the ver attribute assigned (if used).
Tag will accept the following attributes (case-sensitive):
<txp:if_plugin name="zem_plugin_lang" version="4"> <txp:zem_contact to="dest@example.com" /> </txp:if_plugin>
ver
attribute deprecated and renamed version
<txp:if_search>
The if_search tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_search> ...conditional statement... </txp:if_search>
The tag will execute the contained statements if the called page is the result of a search.
This tag has no attributes.
<txp:if_search> <link rel="stylesheet" href="<txp:css name="search" />" type="text/css" /> <txp:else /> <link rel="stylesheet" href="<txp:css />" type="text/css" /> </txp:if_search>
<txp:if_search_results>
The if_search_results tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_search_results> ...conditional statement... </txp:if_search_results>
The tag will execute the contained statements if the current article list contains a certain amount of entries matching the search term - mostly more than zero.
A typical application of this tag is the conditional output of a "Sorry, we found no items matching your search request." message, but the min
and max
attributes allow for a finer grained reaction to search queries.
Tag will accept the following attributes (case-sensitive):
max
, the tags enclosed by this conditional tag are rendered.min
, the tags enclosed by this conditional tag are rendered.1
<txp:if_search_results> <p>These articles match your search request: </p> <txp:else /> <p>Sorry, we were not able to find a page matching your search request <strong><txp:search_term /></strong>.</p> </txp:if_search_results>
Other tags used: else, search_term
<txp:if_search> <txp:article pgonly="1" limit="10" /> <txp:if_search_results> <p>These articles match your search request: </p> <txp:article limit="10" searchform="search_results" /> <txp:else /> <p>Sorry, we were not able to find a page matching your search request <strong><txp:search_term /></strong>.</p> </txp:if_search_results> </txp:if_search>
pgonly
attribute. Once the search has been performed (internally) and Textpattern knows how many search results there are, you can then use if_search_results to detect whether there were any or not.form
attributes, which can safely be omitted when using pgonly
). Failure to keep the tags in sync will result in strange article counts or odd behaviour.Other tags used: if_search, article, else, search_term
<txp:if_search_results max="500"> <p>These articles match your search request: </p> <txp:else /> <p>Seems like you are looking for a very common search term. Try using a more specific search phrase.</p> </txp:if_search_results>
Other tags used: else
<txp:if_section>
The if_section tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_section> ...conditional statement... </txp:if_section>
The tag will execute the contained statements if the called page is part of the section specified with the name attribute.
Tag will accept the following attributes (case-sensitive):
name=", other_section"
and name="default, other_section"
are equivalent).<txp:if_section name="about"> <p>danger, ego pages ahead!</p> <txp:else /> <p>nothing. just nothing. any ideas? anybody?</p> </txp:if_section>
Other tags used: else
<h4>Menu</h4> <ul class="nav"> <li<txp:if_section name=",article"> class="active"</txp:if_section>> <txp:section link="1" title="1" name="" /> </li> <li<txp:if_section name="portfolio"> class="active"</txp:if_section>> <txp:section link="1" title="1" name="portfolio" /> </li> <li<txp:if_section name="about"> class="active"</txp:if_section>> <txp:section link="1" title="1" name="about" /> </li> </ul>
A different way of marking the active section can be accomplished by using section_list and its attribute active_class
. While the above snippet will mark the list item, section_list will mark solely the link.
Other tags used: section
<txp:if_status>
The if_status tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_status> ...conditional statement... </txp:if_status>
The tag will execute the contained statements depending on the requested page's HTTP status condition. Normal pages result in a status code of "200", while missing pages set Textpattern's status to "404".
This tag provides a method of sharing one page template between common pages and error pages, but including different output depending on the page's HTTP status.
Tag will accept the following attributes (case-sensitive):
<txp:if_status status="404"> <p>The page you requested could not be found.</p> </txp:if_status>
<txp:if_thumbnail />
The if_thumbnail tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_thumbnail> ...conditional statement... </txp:if_thumbnail>
The tag will execute the contained statements if the current image (from an images) has a thumbnail assigned to it. Must always be used in an image context.
This tag has no attributes.
<txp:images author="neo" wraptag="div" class="author_gallery"> <txp:if_thumbnail> <div><txp:thumbnail /></div> <txp:else /> <div>No thumbnail</div> </txp:if_thumbnail> <txp:image_info /> </txp:images>
Other tags used: images, else, image_info, thumbnail
<txp:if_variable>
The if_variable tag is a conditional tag and always used as an opening and closing pair, like this...
<txp:if_variable> ...conditional statements... </txp:if_variable>
It tests the existence and/or value of a global variable set with the variable tag.
Tag will accept the following attributes (case-sensitive):
value=""
), the tag returns true if the variable is defined, but has no value.See the variable page for examples.
<txp:image />
The image tag is a single tag that Textpattern will replace with the <img src="..." />
HTML tag matching the image of the numeric id
assigned by Textpattern when the image was uploaded via the Textpattern Images tab.
Tag will accept the following attributes (case-sensitive):
class
attribute applied to the wraptag
, if set, otherwise to the img
tag.<
, >
and &
for the image's alt
and title
attributes.html
or unset.html
.height="0"
to turn off the output of a height attribute in the <img>
tag (thus the browser will scale the height if a width is used)id
attribute applied to the wraptag
, if set, otherwise to the img
tag.id
assigned at upload of the image to display. Can be found on the Images tab. If both name
and id
are specified, name
is used while id
is ignored.width="0"
to turn off the output of a width attribute in the <img>
tag (thus the browser will scale the width if a height is used)img
tag, specified without brackets.align
attribute for the img
tag. Recommended that you use CSS via class
or html_id
attribute instead.<txp:image id="42" />
<txp:image name="chickens.jpg" class="boxit" />
boxit
to the <img>
tag.The style could be defined like this
img.boxit { background: #fff; border: 1px solid #ccc; display: block; margin: -5px 5px 5px -5px; padding: 4px; position: relative; }
Had the wraptag
attribute been used, the boxit
class would have been applied to that instead of directly to the image.
width
and height
addedalign
deprecatedescape
changed from unset to html
<txp:image_author />
The image_author tag is a single tag that Textpattern will replace with the author's name associated with the current image in an images list. It can only be used inside <txp:images />
.
Tag will accept the following attributes (case-sensitive):
<txp:images category="mammals"> <a href="<txp:image_url />"><txp:thumbnail /></a> <div class="by">by <txp:image_author /></div> </txp:images>
Other tags used: images, thumbnail
<txp:images category="fish"> <a href="<txp:image_url />"><txp:thumbnail /></a> <div class="by">by <txp:image_author link="1" /></div> </txp:images>
site.com/author/image/User+Name
.Other tags used: images, thumbnail
<txp:image_date />
The image_date tag is a single tag that Textpattern will replace with the uploaded date of the current (or given) image. Should usually be used in an image form, although it may be used on its own providing you specify an id or name.
Tag will accept the following attributes (case-sensitive):
id
assigned at upload of an image to display. The IDs can be found on the Images panel.name
and id
are specified, the id takes precedence.<txp:images category="mammals"> <a href="<txp:image_url />"><txp:thumbnail /></a> <div class="img_info"> <txp:image_info type="caption, author" break=" by " /> <txp:image_date format="%e %b %Y" /> </div> </txp:images>
Other tags used: images, image_url, image_info, thumbnail
<txp:image_display />
The image_display tag is a single tag that is intended to be used in tandem with image_index.
The image_display tag displays an image specified by the page URL which in turn is built by its tandem tag image_index.
To use this tag successfully, it has to be placed either inside an article which shares a common category with the images to display (thereby linking article and image categories), or in a location at the page template which is displayed without any special article context.
If this tag seems to display no image at all, it probably resides inside an article which is never rendered as it does not belong to the currently active category.
This tag takes no attributes.
<txp:image_display />
<txp:image_index />
The image_index tag is a single tag that is intended to be used in tandem with image_display.
It renders thumbnails of all images contained in an image category. This category can be specified as an attribute to the tag and defaults to the current site category as given in the page's URL.
The thumbnail images are linked to an address which will pass the image id plus the active category on to the tandem image_display tag. It is up to the user to include this tandem tag at an appropriate place inside the page template.
Tag will accept the following attributes (case-sensitive):
0
(no limit).0
.id
(image id#)name
(image name)category
(image category)ext
(image extension)w
(image width)h
(image height)alt
(image alt text)caption
(image caption text)date
(date posted)author
thumbnail
rand()
(random)name asc
.These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
labeltag="h3"
)wraptag="ul"
)wraptag
attribute value.break="li"
) or some string to separate list items.br
(but see break cross-reference for exceptions).<txp:image_index category="personal" break="li" wraptag="ol" />
c
attribute deprecated and renamed category
<txp:image_info />
The image_info tag is a single tag that Textpattern will replace with the relevant image data from the current image. Should usually be used in an image form, although it may be used on its own providing you specify an id or name.
Tag will accept the following attributes (case-sensitive):
class
attribute applied to each break tag.class
attribute applied to the wraptag
.<
, >
and &
for the given types.html
or unset.html
id
assigned at upload of an image to display. The IDs can be found on the Images panel.name
and id
are specified, the id takes precedence.id
name
category
category_title
alt
caption
ext
(image extension)author
(login name: see image_author to display the author's real name)w
(image width)h
(image height)thumb_w
(image thumbnail width)thumb_h
(image thumbnail height)date
(timestamp of image upload: this is not very useful so consult image_date for a better alternative)caption
.<txp:images category="mammals"> <txp:thumbnail /> <txp:image_info type="caption" wraptag="div" class="img_cap" /> </txp:images>
<div class="img_cap">...</div>
tags. Note that the image IDs/names are not specified inside the container because they are automatically assigned from the <txp:images>
tag for each image in the given category.Other tags used: images, thumbnail
<txp:images category="birds, mammals" thumbnail="1" sort="category asc"> <txp:if_different> <h4><txp:image_info type="category_title" /></h4> </txp:if_different> <txp:thumbnail wraptag="div" /> <txp:image_info type="w, h" wraptag="div" class="img_dims" break=" x " /> by <txp:image_info type="author" /> </txp:images>
<txp:if_different>
conditional can be used to output the category title at the top of the list of images each time it changes.Other tags used: images, thumbnail, if_different
<txp:image_info id="5" type="category_title" />
Image Tags are a subcategory of the Tag Reference. They are tags that are used to display pictures that are managed through the Images (panel).
Download Category:Image_Tags book
<txp:image_url />
The image_url tag is a single or a container tag that Textpattern will replace with the URL of the current image in an images list, or the specific image if given an id or name.
If used as a container tag, it must be specified as an opening and closing pair of tags, like this:
<txp:image_url> ...link contents... </txp:image_url>
Tag will accept the following attributes (case-sensitive):
id
assigned at upload of an image to display. The IDs can be found on the Images panel.auto
.name
and id
are specified, the id takes precedence.Used as a single tag:
<txp:images category="mammals"> <a href="<txp:image_url />"><txp:thumbnail /></a> </txp:images>
or as a container:
<txp:images category="mammals"> <txp:image_url><txp:thumbnail /></txp:image_url> </txp:images>
Other tags used: images, thumbnail
<txp:images />
The images tag is a single or container tag that Textpattern will use to gather a list of matching images uploaded via the Textpattern Images (panel). Utilising the other image tags in the suite image_info, image_url, image_date and if_thumbnail) you can display simple image galleries from this list.
If used as a container tag, it must be specified as an opening and closing pair of tags, like this:
<txp:images> ...contained statements... </txp:images>
This is equivalent to putting the contained statements into a form named "my_form" and using <txp:images form="my_form" />
.
By default, the tag is context-sensitive, which means that in the absence of any filter attributes (id, name, category, author, realname, extension, thumbnail), it will return image IDs from the first of:
In the Article Image field of the Write panel, you may put a comma-separated list of IDs, and this tag will treat them as a gallery.
Tag will accept the following attributes (case-sensitive):
extension=".jpg, .png"
id
attribute applied to the wraptag
, if set, otherwise to the img
tag.id
s assigned at upload. The IDs can be found on the Images (panel).<txp:images id="11,54,6,29" />
.0
(unlimited).0
.limit
is set.)pageby="limit"
to allow pagination to automatically follow the value of the limit
attribute. NOTE: newer and older will paginate all content types at once.id
(image id#)name
(image name)category
extension
(image extension)author
alt
caption
date
w
(image width)h
(image height)thumb_w
(image thumbnail width)thumb_h
(image thumbnail height)rand()
(random)name asc
1
) or not (0
).These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
labeltag="h3"
)wraptag="ul"
)wraptag
attribute value.break="li"
) or some string to separate list items.br
(but see break cross-reference for exceptions).This example shows the outcome of various attribute configurations to give you an idea of what to expect from the tag. More concrete examples follow.
NB: THESE MAY NOT BE CORRECT ANY MORE DUE TO TAG CHANGES SINCE THE EXAMPLES WERE WRITTEN. NEED VERIFICATION.
<txp:images auto_detect="" />
<txp:images auto_detect="" sort="id desc" />
id
in descending order.<txp:images />
<txp:images id="" />
<txp:images name="" />
<txp:images category="" />
category='<txp:custom_field name="my_cats" />'
it will show no images if the custom field is empty.<txp:images id="2,3,6" />
<txp:images name="lion.jpg, zebra.jpg" />
<txp:images name="pengiun.jpg" />
<txp:images category="mammals, birds" />
<txp:images category=", mammals, birds" />
<txp:images category=" " />
category=","
also works, but a space looks better).<txp:images author="attenborough, morris" />
<txp:images realname="David+Attenborough" />
<txp:images category="mammals, birds" author="attenborough, morris" />
<txp:images category="mammals, birds" extension=".jpg" />
<txp:images category="mammals, birds" extension=".jpg" author="attenborough, morris" />
<txp:images extension=".gif" />
<txp:images category="mammals, birds" thumbnail="1" />
<txp:images thumbnail="1" />
<txp:images thumbnail="0" />
A popular design pattern is to create a thumbnail grid of images inside an article, where each thumbnail is a link to the full-size image. The best way to achieve this is by using the images tag in your article where the grid should appear, and calling a Form that will generate each grid item.
The markup you use for your grid should reflect the kind of information you want to display. For example, if it's just going to be a grid of thumbnail images only, an unordered list is probably appropriate that wraps the thumbnails horizontally. But if you want to include text output for each image too (e.g., a small caption), then you might structure your grid as a series of figures with figure captions.
This example will demonstrate an horizontal grid of four images having captions, but you should be able to see how to modify the code for whatever HTML elements you want to use.
Let's say you have a paragraph of text, followed by your image grid, followed by another paragraph (or whatever) in your article:
...end of a paragraph. <txp:images id="n,n,n,n" thumbnail="1" form="image-grid" wraptag="section" class="thumbgrid" break="figure" /> Beginning of a new paragraph...
The images tag in this example is using three content attributes (id
, thumbnail
, and form
) and three presentation attributes (wraptag
, class
, and break
). The order in which you position any of the attributes in the images tag makes no difference. Do it the way it makes sense to you.
Note that for small grids of a few images like this, using the id
attribute to call the images individually is the best way to go â?? it keeps your categories to a minimum. On the other hand, if you expect to have many images in your grid (say, more than ten), you might just assign them to a unique category (using category="name"
) then call the images by their assigned category instead.
The thumbnail
attribute is necessary to display the thumbnails of the images rather than the full-size images. For this to work, the thumbnails for each image must be created first in the Images panel. Since most people want responsive web designs anymore, make your thumbnails reasonably big: 300px2 is good.
The form
attribute is needed to call the name of your grid form, which we'll come back to below. Give it a meaningful but generic name because you can reuse the Form for other grids.
The three presentational attributes are saying: wraptag
="use this HTML element as the container for my grid"; class
="use this class name as the selector for the container"; break
="use this HTML element around each grid item". In our example, the HTML elements chosen are section
and figure
, and the class selector name is "thumbgrid". The fig caption
will be added by way of the Form.
Now create a new miscellaneous Form called "image-grid" and put this code in it:
<a href="<txp:image_url />"><img src="<txp:image_url thumbnail="1" />" /></a> <figcaption><txp:image_info /></figcaption>
The code above will be used for each grid item when output in your article. It's basically saying 'here's the thumbnail image and the link path we want to put on it, and here's the caption that should go with it.
Conceptually speaking, when called into the images tag in your article, the basic HTML structure output will look like this:
<section class="thumbgrid"> <figure> <a><img></a> <figcaption>...</figcaption> </figure> <figure> <a><img></a> <figcaption>...</figcaption> </figure> Etc. </section>
The grid described above will need styling, and you're responsible for that, but following are a few base rules to start with. These are for desktop layouts, but assumes you want a responsive design and the rest of your CSS is in that direction:
.thumbgrid { width: auto; margin: 1em 0; text-align: center; } .thumbgrid > figure { width: 21%; display: inline-block; float: none; /* this is the part that makes horizontal layout work */ vertical-align: top; /* needed because caption lengths likely vary */ } .thumbgrid > img { padding: 2%; }
<txp:images category="birds, mammals" thumbnail="1" sort="category asc"> <txp:if_different> <h4><txp:image_info type="category_title" /></h4> </txp:if_different> <txp:thumbnail wraptag="div" /> <txp:image_info type="w, h" wraptag="div" class="img_dims" break=" x " /> by <txp:image_info type="author" /> </txp:images>
<txp:if_different>
conditional can be used to output the category title at the top of the list of images each time it changes.Other tags used: image_info, thumbnail, if_different
<txp:images limit="6" category="gallery"> <a href="<txp:image_url />" title="Click to view original"> <img src="<txp:site_url />timthumb.php?src=<txp:image_url />&w=200" alt="<txp:image_info type='alt' />" /> </a> <dl> <dt>Author:</dt> <dd><txp:image_author /></dd> </dl> </txp:images>
<txp:keywords />
The keywords tag is a single tag that Textpattern will replace with the keywords associated with the article being displayed. The tag can be used in an article Form, or within Pages (templates), either wrapped within a given article tag, or directly in the template itself so long as the context is with a single article (as opposed to an article list). For keywords metadata, see meta keywords tag.
This tag has no attributes.
In this example, keywords are used in an article Form along with other article components. The keywords themselves are used like a list of topical "tags", e.g., like you would use for more granular searching. The keywords would be presented (via CSS) horizontally (ideally) above the article's excerpt.
<h3><txp:permlink><txp:title /></txp:permlink></h3> <p><txp:posted /></p> <p><txp:keywords /></p> <txp:excerpt /> <txp:body />
Other tags used in example: permlink, title, posted, excerpt, and body
meta
element valuesIn this example, keywords are used directly in a Page (template) to insert content=""
values in a meta
element.
<meta name="keywords" content="<txp:keywords />" />
This works if the context is a single article being displayed.
The same result can be done by putting the keywords inside an if individual article tag (though a bit more code than necessary).
<txp:if_individual_article> <meta name="keywords" content="<txp:keywords />" /> </txp:if_individual_article>
In both of the above, if a given article has keywords associated with it, they will fill the meta value. If not, the meta element remains with no content=""
values. This might be okay if you know for sure all articles will have keywords assigned.
If not, a metadata tag in your template with no value might not be desired. In which case you could set it up as a condition; if there are no keywords on the article, the entire meta element is not added to the template.
<txp:if_keywords> <meta name="keywords" content="<txp:keywords />" /> </txp:if_keywords>
Either of these uses might work well for certain pages where a single article is in context, but it doesn't account for other page contexts, like home pages with complex content layouts, or pages displaying article lists (rather than single articles). In other words, these are not copy/paste solutions for every template in your site. You may, in fact, create some metadata values manually if the context of certain pages doesn't change much.
Other tags used in example 2: if_individual_article and if_keywords.
cbe_keywords uses keywords to offer tagging features.
chh_keywords provides tags to create a link list of an articleâ??s keywords, browse lists of articles by keyword, and list all keywords in a tag cloud.
rah_metas, an SEO- and meta-tool, includes several keyword related attributes.
ras_if_article_keywords is a conditional tag that compares a keyword list as an attribute against the keywords associated with a particular article.
tru_tags uses keywords to offer tagging features.
wet_haystack allows site publishers to modify the default search behavior by adding additional article fields to the set of indexed content, including keywords.
<txp:lang />
The lang tag is a single tag. Textpattern will replace this tag with the 2-letter code of the language which is set as the site's language preference on the Preferences Subtab, according to RFC 1766.
This tag has no attributes.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<txp:lang/>" lang="<txp:lang/>"> <head> <title><txp:site_name/> | <txp:site_slogan/></title> <meta http-equiv="Content-Language" content="<txp:lang/>" /> </head>
lang
tag is useful for ensuring translators, search engines and content parsers handle the document in the correct manner.Other tags used: site_name, site_slogan
<txp:link />
The link tag is a single tag which is used to return an HTML hyperlink defined under the Links tab. It uses the Title field as the link's text.
This tag is used in "link" forms or inside the linklist container tag.
Tag will accept the following attributes (case-sensitive):
rel
attribute.<p><txp:link /><br /><txp:link_description /></p>
Other tags used: link_description
<txp:link_author />
The link_author tag is a single tag that Textpattern will replace with the author's name associated with the current link in a linklist. It can only be used inside <txp:linklist />
.
Tag will accept the following attributes (case-sensitive):
<txp:link_category />
The link_category tag is a single tag which returns the link category as text. This tag is used in a "link" form or inside the linklist container tag to return information about the current link in a linklist.
0
(category name) or 1
(category title).0
.<a class="thislink" href="<txp:link_url />"> <txp:link_name escape="html" /> </a> : <txp:link_category title="1" />
Other tags used: link_url, link_name
<txp:link_date />
The link_date tag is a single tag which returns the date the link was created as text. This tag is used in a "link" form or inside the linklistcontainer tag to return information about the current link in a linklist.
Tag will accept the following attributes (case-sensitive):
since
.0
(local time) or 1
(GMT).0
.<a class="thislink" href="<txp:link_url />"> <txp:link_name escape="html" /> </a> : <txp:link_date />
Other tags used: link_url, link_name
<txp:link_description />
The link_description tag is a single tag which is used to return the text from the Description field as defined under the "links" tab. This tag is used in a "link" form or inside a linklist container tag to display information abouth the current link.
Tag will accept the following attributes (case-sensitive):
html
or unset.html
.<p><txp:link /><br /><txp:link_description /></p>
Other tags used: link
escape
changed from unset to html
<txp:link_feed_link />
The link_feed_link tag is a single tag. Textpattern will replace this tag with an anchor to the site's "links" RSS feed.
Tag will accept the following attributes (case-sensitive):
rss
or atom
.rss
.a
or link
.a
.RSS feed
or Atom feed
.These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
wraptag="ul"
)wraptag
attribute value.Notes:
<txp:link_feed_link flavor="atom" label="Commerce Links" />
class
attribute addedformat
attribute added.
<txp:link_id />
The link_id tag is a single tag which returns the numerical ID of the link. This tag is used in a Links form or inside the linklist container tag to show information about the current link in the list.
This tag has no attributes.
<txp:linklist category="dogs"> Link: <a href="<txp:link_url />"><txp:link_name /></a> (id: <txp:link_id /> | cat: <txp:link_category />) </txp:linklist>
Other tags used: linklist, link_name, link_category
<txp:link_name />
The link_name tag is a single tag which returns the name of the link as assigned on the links pane as text. This tag is used in a Links form or inside the linklist container tag to display information about the current link.
Tag will accept the following attributes (case-sensitive):
html
or unset.html
.<a class="thislink" href="<txp:link_url />"><txp:link_name escape="html" /></a>
Other tags used: link_url
escape
changed from unset to html
Link Tags are a subcategory of the Tag Reference. They are tags that are used to display links that are managed through the Links tab.
Download Category:Link_Tags book
<txp:link_to_home>
The link_to_home tag is primarily a container tag that returns a link to the site's home page. It will apply a hyperlink to whatever it wraps.
The tag can, however, be used as a single tag to generate a raw base URL of the site:
<txp:link_to_home />
In this mode it operates identically to site_url.
Tag will accept the following attributes (case-sensitive):
<txp:link_to_home><txp:site_name /></txp:link_to_home>
Other tags used: site_name
<txp:link_to_next>
The link_to_next tag can be used as a single tag or a container tag to return the permanent URL of the next article by posting date. If used as a container tag, the HTML required to output a hyperlink is returned; if used as a single tag, only the URL itself is returned.
Tag will accept the following attributes (case-sensitive):
0
(no) or 1
(yes).0
.<txp:link_to_next><txp:next_title /></txp:link_to_next>
Other tags used: next_title
<txp:link_to_next showalways="1">Next</txp:link_to_next>
This will always display the text "Next", even when there is no next article.
showalways
will enable this tag to display what is wrapped inside it, next_title returns nothing if there is no next title, so nothing is displayed. Use text or the returned value that you need displayed.The container tag returns only a very basic link, which doesn't allow for customizing the link title, or adding a CSS class, etc. Using the tag in its single tag capacity opens up a lot more possibilities.
For example, to give the link an HTML title attribute of the next article's title, and also apply a class to it:
<a href="<txp:link_to_next />" title="<txp:next_title />" class="orange"><txp:next_title /></a>
Other tags used: next_title
<txp:link_to_prev>
The link_to_prev tag can be used as a single tag or a container tag to return the permanent URL of the previous article by posting date.
If used as a container tag, the HTML required to output a hyperlink is returned; if used as a single tag, only the URL itself is returned.
Tag will accept the following attributes (case-sensitive):
0
(no) or 1
(yes).0
<txp:link_to_prev><txp:prev_title /></txp:link_to_prev>
Other tags used: prev_title
<txp:link_to_prev showalways="1">Previous</txp:link_to_prev>
showalways
will enable this tag to display what is wrapped inside it, prev_title returns nothing if there is no previous title, so nothing is displayed. Use text or the returned value that you need displayed.The container tag returns only a very basic link, which doesn't allow for customizing the link title, or adding a CSS class, etc. Using the tag in its single tag capacity opens up a lot more possibilities.
For example, to give the link an HTML title attribute of the previous article's title, and also apply a class to it:
<a href="<txp:link_to_prev />" title="<txp:prev_title />" class="orange"><txp:prev_title /></a>
Other tags used: prev_title
<txp:link_url />
The link_url tag is a single tag which returns the URL of the link as text. This tag is used in a Links form or inside the linklist container tag to show information about the current link in the list.
This tag has no attributes.
<a class="thislink" href="<txp:link_url />"><txp:link_name /></a>
Other tags used: link_name
<txp:linkdesctitle />
The linkdesctitle tag is a single tag which is used to return an HTML hyperlink, defined under the Links tab.
It uses the Title field as the link's text; the Description field contents will be displayed as an anchor title attribute. This tag is used in a link form or inside the linklist container tag.
Tag will accept the following attributes (case-sensitive):
rel
attribute.<p><txp:linkdesctitle /></p>
Link, title=Description
<txp:linklist />
The linklist tag is a single or a container tag which is used to produce a list of links from the predefined list created on the Links tab.
If used as a container, it must be specified as an opening and closing pair of tags, like this:
<txp:linklist> ...contained statements... </txp:linklist>
Tag will accept the following attributes (case-sensitive):
plainlinks
.id
s assigned at link creation time. The IDs can be found on the Links panel.0
(no limit).0
.limit
"limit
attribute. Use pageby="limit"
to do this, which means you will not have to amend two values if you subsequently decide to alter the limit
id
, linkname
, url
, description
, category
, date
, linksort
, rand()
(random).linksort asc
.These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
labeltag="h3"
)wraptag="ul"
)wraptag
attribute value.break="li"
) or some string to separate list items.br
(but see break cross-reference for exceptions).<txp:linklist form="Links" category="general" limit="10" sort="linksort" wraptag="p" />
This example uses the displayed page's category as the criterion for choosing the linklist's category.
<txp:if_category name="100"> <txp:linklist label="First Floor" category="First" wraptag="ol" break="li" /> </txp:if_category> <txp:if_category name="200"> <txp:linklist label="Second Floor" category="Second" wraptag="ol" break="li" /> </txp:if_category>
Other tags used: if_category
<txp:link /><br /> <txp:link_description /><br /> <txp:linkdesctitle />
The form is repeated for each link provided by linklist.
id
attribute addedpageby
attribute added to enable paging via newer and olderauthor
and realname
attributes addedauto_detect
added to allow automatic (URL-based) contextual listings
List Tags are a subcategory of the Tag Reference.
Download Category:List_Tags book
Markup Tags are a subcategory of the Tag Reference. They are tags that are used to add (mostly) meta information to a page through or to html elements.
Download Category:Markup_Tags book
<txp:meta_author />
Used in the head of an individual article page template, the meta_author tag is a single tag. Textpattern will replace this tag with an HTML meta tag as follows:
<meta name="author" content="Article author's name" />
Tag will accept the following attributes (case-sensitive):
0
(login name), or 1
(real name).0
.Article's author name: sysop
Tag: In the head of an individual article page
<txp:meta_author />
Output:
<meta name="author" content="sysop" />
title
attribute added
<txp:meta_keywords />
Used in the head of an individual article page template, the meta_keywords tag is a single tag. The tag can be used in an article Form, or within Pages (templates), either wrapped within a given article tag, or directly in the template itself so long as the context is with a single article (as opposed to an article list). Textpattern will replace this tag with an HTML meta tag as follows:
<meta name="keywords" content="keywords as set in article's keywords field" />
This tag takes no attributes.
The keywords field has a 255 character limit by default, which includes spaces and commas. This is simply the MySQL database default. You can edit this using, for example, phpMyAdmin.
Meta_keywords tag returns a HTML meta tag, populated with an article's keywords. The tag should always be placed to your Page template's <head>
section, between closing and opening HTML head
tags.
<txp:meta_keywords />
Above will output keywords metadata with content=""
populated with the list of keywords set in the article's keywords field. The tag returns nothing if no keywords are set for an article.
If article's keywords field contains sauce, caramel, sugar
, the tag will output following.
<meta name="keywords" content="sauce, caramel, sugar" />
<txp:modified />
The modified tag is a single tag which is used to return the modification date of the article being displayed. The format is determined by the settings specified in the Date Format, or Archive Date Format, fields on the Basic Preferences tab.
Tag will accept the following attributes (case-sensitive):
wraptag
element.since
, iso8601
, w3cdtf
, or rfc822
.0
(local time) or 1
(GMT).0
.<p>modified: <txp:modified format="since" /></p>
would result in:
<p>modified: 29 Days ago</p>
<p>modified: <txp:modified format="%b %d, %Y" /></p>
would result in:
<p>modified: May 28, 2005</p>
wraptag
and class
attributes added.
Navigation Tags are a subcategory of the Tag Reference. These are all tags that (can) create hyperlinks.
Download Category:Navigation_Tags book
<txp:newer>
The newer tag is both a single tag and a container tag. Should be used in a page after an article tag.
Textpattern will replace this tag with a link to the next list of articles in the sort order. The container tags wrap the text or tag assigned to the link. As a single tag it outputs the URL for the next list page.
An article list consists of the assigned number of articles set by the article tag. If there are no articles available having Newer status (articles ranked higher, or newer, in the present sort criteria than the present top of page article) <txp:newer>
will not display unless the showalways
attribute is set to 1
. It is normally seen used in tandem with older.
Given a <txp:article limit="5" />
tag on the page in question, <txp:newer>
will page up five articles at a time from the oldest post forward in time to the most recently posted article.
Tag will accept the following attributes (case-sensitive):
<
, >
and &
.html
or unset.html
0
(no) or 1
(yes).0
<txp:newer>Newer</txp:newer>
<a href="<txp:newer />"><txp:image name="right-arrow.gif" /></a>
<txp:newer><txp:image name="right-arrow.gif" /></txp:newer>
The difference between examples 2 and 3 is that the tags in example 2 will display the image even if there are no newer articles, those used in example 3 won't.
Other tags used: image
title
attribute reintroduced after being accidentally removedescape
attribute
<txp:next_title />
The next_title tag is a single tag which Textpattern will replace with the title of the next article in the sort order.
The container tag link_to_next wraps the text or tag and assigns the link.
This tag takes no attributes.
<txp:link_to_next><txp:next_title /></txp:link_to_next>
Other tags used: link_to_next
<txp:older>
The older tag is both a single tag and a container tag. Should be used in a page after an article tag.
Textpattern will replace this tag with a link to the next list of articles in the sort order. The container tags wrap the text or tag assigned to the link. As a single tag it outputs the URL for the previous list page.
An article list consists of the assigned number of articles set by the article tag. If there are no articles available having Older status (articles ranked lower, or later, in the present sort criteria than the present bottom of page article) <txp:older>
will not display unless the showalways
attribute is set to 1
. It is normally seen used in tandem with newer.
Given a <txp:article limit="5" />
tag on the page in question <txp:older>
will page down five articles at a time from the most recent post back in time to the oldest.
Tag will accept the following attributes (case-sensitive):
<
, >
and &
.html
or unset.html
0
(no) or 1
(yes).0
<txp:older>Older</txp:older>
<a href="<txp:older />"><txp:image name="left-arrow.gif" /></a>
<txp:older><txp:image name="left-arrow.gif" /></txp:older>
The difference between examples 2 and 3 is that the tags in example 2 will display the image even if there are no older articles, those used in example 3 won't.
Other tags used: image
title
attribute reintroduced after being accidentally removedescape
attribute
<txp:output_form>
The output_form tag can be used as a single or a container tag. Textpattern will replace this tag with the content resulting from the form called by the tag.
For the container tag usage, see the yield tag.
Tag will accept the following attributes (case-sensitive):
You can use this tag in combination with a form to create small pieces of text that would not otherwise be managed as a regular article. For example you might define the copyright conditions of content on your site in a form and add that to one or more places via the output_form tag. Name the form copyright, save it as type misc and call the form using the tag structure...
<txp:output_form form="copyright" />
Notice that Staff Writers and Freelancers can not edit the contents of forms.
Suppose you want to manage the DOCTYPE
and the <head>
section of your page template as a single-sourced block of content. You can create a form called page-header and save it as type misc. The content of the form might look like this (just one example):
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head> <title><txp:page_title /></title> <txp:css format="link" /> </head>
Then in each of your pages, you insert the header using...
<txp:output_form form="page-header" />
...which will add the header to all the pages automatically.
The advantage of this is that when you edit your page header, you can do so once in the form and it will update all instances of use in your different pages at the same time.
<txp:page_title />
The page_title tag is a single tag that displays text depending on the context it is used. Its primary purpose is for outputting information suitable for the HTML <title>
tag.
Results appear as follows:
Tag will accept the following attributes (case-sensitive):
:
(a colon).<title><txp:page_title separator=" » " /></title>
<txp:page_url />
The page_url tag is a single tag. It is used to return a particular component of the URL from the current page being displayed.
Tag will accept the following attributes (case-sensitive):
request_uri
: current article's URL-title including any query stringid
: current article's id on a single article pages
: current page's sectionc
: current page's categoryq
: search query stringpg
: current page number in article list modemonth
: current page's month on time based article listsauthor
: current page's author on article lists filtered by authorstatus
: HTTP error response (200, 404)css
: current style sheet namepage
: current page template namerequest_uri
.<p>Article ID: <txp:page_url type="id" /><br /> From section: <txp:page_url type="s" /> (Result: <txp:page_url type="status" />)</p>
<txp:password_protect />
The password_protect tag is a single tag. When Textpattern encounters the password protect tag it causes the user to be prompted for username and password, if these match the attributes set in the tag, the user is allowed access to the site. The tag can go anywhere, from page template, to article and forms.
Tag will accept the following attributes (case-sensitive):
<txp:password_protect login="theuser" pass="thepassword" />
<txp:permlink>
The permlink can be used as a single tag or a container tag to return the permanent url of the article being displayed.
If used as a container tag, the HTML required to output a hyperlink is returned; if used as a single tag, only the URL itself is returned.
Tag will accept the following attributes (case-sensitive):
class
attribute instead.<txp:permlink><txp:title /></txp:permlink>
would result in:
<a rel="bookmark" href="http://example.com/index.php?id=2">Article title</a>
Other tags used: title
<txp:permlink />
would result in something like:
http://example.com/index.php?id=2
By default permlink returns only a very basic link, which doesn't allow for customizing the link title, or adding a CSS class, etc. Using the tag in its single tag capacity opens up a lot more possibilities.
For example, to have the permanent link have an HTML title attribute of the article's title, and also apply a class to it named "orange":
<a href="<txp:permlink />" title="<txp:title />" class="orange"><txp:title /></a>
Other tags used: title
<txp:php>
Textpattern's php tag is a container tag that provides the same output abilities as <?php //Code goes here... ?>
. Textpattern's tag version is used like this:
<txp:php> // Code goes here... </txp:php>
Control over where this tag is allowed to appear (i.e., the privileges required to allow it to appear in pages and forms) are governed by settings in the Advanced Preferences tab.
This tag has no attributes.
When inserting markup or PHP into the content boxes of a Textpattern article:
<?php â?¦ ?>
<notextile>
tag and Textpattern php tag to disable Textile parsing:<notextile> <txp:php>... code goes here ...</txp:php> </notextile>
All Textpattern tags have equivalent programmatic names which are exactly the same as the tag names. For example, <txp:recent_articles />
is recent_articles()
.
You must pass an array to all tag functions, even if there are no attributes to set. For tags that require no attributes or those that you do not wish to modify the defaults, pass an empty array, e.g., category1(array());
<txp:php> phpinfo(); </txp:php>
<txp:php> echo "The current TXP category is: " . category(array( 'title' => '1', 'link' => '1', 'wraptag' => 'div' )); </txp:php>
<txp:popup />
The popup tag is a single tag. Textpattern will replace this tag with a popup selector for browsing by section or category.
Tag will accept the following attributes (case-sensitive):
1
(yes) or 0
(no).0
.s
(section) or c
(category).c
These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
wraptag="ul"
)wraptag
attribute value.<txp:popup type="c" wraptag="p" />
<txp:popup label="Browse this site" type="c" wraptag="p" />
class
attribute added
<txp:posted />
The posted tag is a single tag which is used to return the publish date of the article being displayed. The format is determined by the settings specified in the Date Format, or Archive Date Format, fields on the Basic Preferences tab.
Tag will accept the following attributes (case-sensitive):
wraptag
element.since
, iso8601
, w3cdtf
, or rfc822
.0
(local time) or 1
(GMT).0
.<p>Posted: <txp:posted format="since" /></p>
would result in:
<p>Posted: 29 days ago</p>
<p>Posted: <txp:posted format="%b %d, %Y" /></p>
would result in:
<p>Posted: Sep 18, 2008</p>
<p>Posted: <txp:posted format="%Y" wraptag="span" class="year" /> <txp:posted format="%B" wraptag="span" class="month" /> <txp:posted format="%e" wraptag="span" class="day" /> </p>
would result in:
<p>Posted: <span class="year">2008</span> <span class="month">Sep</span> <span class="day">18</span> </p>
This provides styling hooks for each date part.
class
and wraptag
added
<txp:prev_title />
The prev_title tag is a single tag which Textpattern will replace with the name (text) of the previous article in the sort order.
The container tag link_to_prev wraps the text or tag and assigns the link.
This tag takes no attributes.
<txp:link_to_prev><txp:prev_title /></txp:link_to_prev>
Other tags used: link_to_prev
Programmer Tags are a subcategory of the Tag Reference. They are tags that help developers and people who can write PHP to customise Textpattern beyond the core tags.
Download Category:Programmer_Tags book
<txp:recent_articles />
The recent_articles tag is a single tag which is used to produce a list of permanent links to recent articles by title.
Tag will accept the following attributes (case-sensitive):
10
.0
single words allowed; 1
single words not allowed on their own lineID
(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
custom_n
) rand()
(random).Posted desc
.These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
labeltag="h3"
)wraptag="ul"
)wraptag
attribute value.break="li"
) or some string to separate list items.br
(but see break cross-reference for exceptions).<txp:recent_articles label="Latest and Greatest" limit="5" />
<txp:recent_articles label="Latest" break="br" wraptag="p" category="code" sort="Section desc" />
<txp:recent_articles label="Recently" break="li" wraptag="ul" />
Styles could go this way
.recent_articles { list-style-type:none; }
<txp:recent_comments />
The recent_comments tag is a single or a container tag. Textpattern will replace this tag with a list of permanent links to recent comments. This list will be displayed with the format
User's Name (Article Name)
If used as a container, the tag must be specified as an opening and closing pair, like this:
<txp:recent_comments> ...contained statements... </txp:recent_comments>
Tag will accept the following attributes (case-sensitive):
10
.discussid
(comment ID#)parentid
(article ID#)name
email
web
ip
(IP address)posted
message
rand()
(random)posted asc
.These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
labeltag="h3"
)wraptag="ul"
)wraptag
attribute value.break="li"
) or some string to separate list items.br
(but see break cross-reference for exceptions).<txp:recent_comments label="Recent Comments" limit="25" wraptag="p" break="br" />
<txp:recent_comments label="Recent Comments" wraptag="ul" break="li" />
Style for default class could go this way:
.recent_comments { list-style-type:none; }
offset
attribute added.
<txp:related_articles>
The related_articles tag can be used as either a single tag or a container tag, and is used to produce a list of related (by category) articles.
When used as a container tag, it must be specified as an opening and closing pair of tags, like this:
<txp:related_articles> ...contained statements... </txp:related_articles>
This is equivalent to putting the contained statements into a form named "my_form" and using <txp:related_articles form="my_form" />
.
Related matches are selected as follows:
If a match to category 1 (category1) or category 2 (category2) of the individual article being displayed is found in either category 1 or category 2 of any other article in the database, it will cause that article to be listed as related.
If category 1 of the individual article being displayed is left blank and category 2 is not blank, then all other articles are selected as being related. If both categories are left blank, then no articles are selected.
Tag will accept the following attributes (case-sensitive):
10
.Category1
", "Category2
", "Category1,Category2
".Category1,Category2
".0
single words allowed; 1
single words not allowed on their own lineID
(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
custom_n
) rand()
(random).Posted desc
.These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
labeltag="h3"
)wraptag="ul"
)wraptag
attribute value.break="li"
) or some string to separate list items.br
(but see break cross-reference for exceptions).<txp:related_articles label="Related" limit="5" />
<txp:related_articles label="Related" limit="10" break="li" wraptag="ul" />
Styles could go this way
.related_articles { list-style-type:none; }
<txp:related_articles label="Related" labeltag="h3" limit="10" break="li" wraptag="ul"> <txp:permlink><txp:title /></txp:permlink> by <txp:author /> </txp:related_articles>
Other tags used: permlink, title, author.
form
and no-widow
attributes added.
<txp:rsd />
The rsd tag is a single tag which is used to insert a Really Simple Discoverability link element helping XML-RPC client programs to configure themselves.
None.
TBW.
<txp:search_input />
The search_input tag is a single tag. This tag will provide a text entry field for search parameters and an optional button to initiate the search.
Tag will accept the following attributes (case-sensitive):
search_input
.id
attribute assigned to the search form.exact
: search terms must exactly match the words in the article in the order given. This mode is also automatically selected if the search term is surrounded with double quotesany
: any of the search terms in an article will cause it to show up in the resultsall
: all of the search terms in the article must exist (in any order) for the article to be included in the resultsexact
15
.These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
wraptag="ul"
)wraptag
attribute value.<txp:search_input label="Search" button="Search" size="20" wraptag="div" />
You can build your own custom search form (as a Textpattern Form) by specifying form="form-name"
inside the <txp:search_input />
Tag:
<txp:search_input form="form-name" />
You would then need to build your Form (i.e., form-name
), and the absolute minimum Tags and attributes required would be:
<form action="<txp:site_url />"> <input type="text" name="q" /> </form>
When using a customized Form, Textpattern doesn't automatically wrap the HTML form output with Form tags, thus you need the opening and closing form
tag pair. The name="q"
attribute and value is required to initiate a search query.
Other tags used: site_url
match
attribute addedhtml_id
attribute added.
<txp:search_result_count />
The search_result_count tag is a single tag that returns the number of articles returned by an article tag. Use if_search to count search results or use in regular page after the article tag. If you need the results' count before the list of results, use the article tag in conjunction with pgonly="1"
(see Example 3).
Tag will accept the following attributes (case-sensitive):
articles found
<txp:if_search> <txp:article /> <txp:search_result_count /> </txp:if_search>
Other tags used: if_search, article
<txp:if_search> <txp:search_result_count text="Hits" /> </txp:if_search />
Other tags used: if_search
<txp:if_search> <txp:article pgonly="1" limit="20" /> <txp:search_result_count text="Hits" /> <txp:article limit="20" /> </txp:if_search />
Other tags used: article, if_search
<txp:search_result_date />
The search_result_date tag is a single tag. This tag will provide the article posted date as returned by the search function.
This tag has no attributes.
Used in a search results form, this offers a search result entry comprising a hyperlinked article title, the date that article was posted and a permanent link to the article.
<h3><txp:permlink><txp:title /></txp:permlink></h3> <p><txp:search_result_date /><br/> <small><txp:permlink><txp:permlink /></txp:permlink> · <txp:posted /></small></p>
Other tags used: title, search_result_date, permlink, posted
<txp:search_result_excerpt />
The search_result_excerpt tag is a single tag. The tag will show the occurence of the search term with some surrounding context.
Tag will accept the following attributes (case-sensitive):
…
).strong
5
.<h3><txp:permlink><txp:title /></txp:permlink></h3> <p><txp:search_result_excerpt hilight="p" limit="15" /> <small><txp:permlink><txp:permlink /></txp:permlink> · <txp:posted /></small></p>
Other tags used: permlink, title, posted
break
added
<txp:search_result_title />
The search_result_title tag is a single tag. This tag will provide a hyperlinked title to an article as returned by the search function.
This tag has no attributes.
In a search results form, this shows the title of an article that matched the visitor's search results, and its posted date.
<h3><txp:search_result_title /> <txp:search_result_date /></h3>
Other tags used: search_result_date
<txp:search_result_url />
The search_result_url tag is a single tag. This tag will provide a hyperlinked URL to an article as returned by the search function.
This tag has no attributes.
Used within a search results form to allow visitors to click on the link and be taken to the article that matched their search results.
<p><txp:search_result_url /></p>
Search Tags are a subcategory of the Tag Reference. They are tags that are used to react to and display information regarding visitor-submitted search results.
Download Category:Search_Tags book
<txp:search_term />
The search_term tag is a single tag which returns the expression the user searched for through the full text search form.
Tag will accept the following attributes (case-sensitive):
html
, HTML entities are used for <, >, and & in the output text. As of Textpattern 4.5 the attribute is deprecated and its use is highly unrecommended. html
<txp:if_search> <h3>Search results</h3> <p>You searched for <strong><txp:search_term /></strong>.</p> <txp:article /> </txp:if_search>
Other tags used: if_search, article
escape
attribute deprecated
<txp:section>
The section tag can be used as either a single tag or container tag. It will display information about the section as defined by either the name
attribute, the section currently being viewed, or the section of the article being displayed (if used within an article form, or an if_individual_article conditional tag).
When used as a containing tag, it will turn the contents into a link to that section. Otherwise, it will return plain text.
Tag will accept the following attributes (case-sensitive):
wraptag
. If no wraptag is supplied (and link="1"
), the class is applied to the anchor instead.0
or 1
0
(plain text)0
or 1
0
(name)0
or 1
0
(display title or full link, depending on link
)<txp:section />
<txp:section link="1" title="1" />
<txp:section link="1" title="1" wraptag="p" name="archive" />
<p>
tags, using the section's title as link text.<txp:section name="archive">My Archive</txp:section>
<a href="http://yourdomain.tld/archive/>My Archive</a>and for messy URLs:
<a href="http://yourdomain.tld/index.php?s=archive">My Archive</a>
<a href="<txp:section name="about" url="1" />"><txp:section name="about" title="1" /></a>
<a href="http://yourdomain.tld/about/">About</a>and for messy URLs:
<a href="http://yourdomain.tld/index.php?s=about">About</a>
class
attribute to the <a>
element when wraptag
is empty.url
to output URL only.
<txp:section_list />
The section_list tag is a single or a container tag which is used to produce a list of linked sections. When used as a container tag, it is used as an opening and closing pair, like this:
<txp:section_list> ...contained statements... </txp:section_list>
Tag will accept the following attributes (case-sensitive):
form
attribute.)include_default
is set to 1
.0
(no)name
page
css
is_default
in_rss
on_frontpage
searchable
title
rand()
(random)name asc
These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.
labeltag="h3"
)wraptag="ul"
)wraptag
attribute value.break="li"
) or some string to separate list items.br
(but see break cross-reference for exceptions).Adding the label "Sections" and wrapping the output in a paragraph with each section on its own line:
<txp:section_list label="Sections" wraptag="p" break="br" />
<txp:section_list break="li" wraptag="ul" />
Styles could go this way
.section_list {
list-style-type: none;
}
This code will add class="active"
to the <li>
element around the "current" section in the list.
<txp:section_list wraptag="ul" break=""> <li<txp:if_section name='<txp:section />'> class="active"</txp:if_section>> <txp:section title="1" link="1" /> </li> </txp:section_list>
form
attribute added.
<txp:site_name />
The site_name tag is a single tag that returns the site's name as defined under the Basic Preferences tab.
This tag has no attributes
<h1><txp:site_name /></h1>
<txp:site_slogan />
The site_slogan is a single tag which is used to output the site's tagline (labeled as Site tagline in the Basic Preferences).
The slogan is a brief (255 characters max) tagline or description of your site which can be used, for example, in XML feeds.
This tag has no attributes.
<p><txp:site_slogan /></p>
The slogan could be used for the content attribute of the description metadata element. Either whole...
<meta name="description" content="<txp:site_slogan />" />
or partial...
<meta name="description" content="<txp:site_slogan />. And the rest of your pithy description would go here." />
<txp:site_url />
The site_url tag is a single tag which returns the full URL of the site (as defined in the Basic Preferences) as text.
If you maintain local development versions of your live sites and import databases between them, then this tag is extremely valuable for ensuring your domain links are never confused (thus broken) between the two locations (see example 1).
This tag has no attributes.
The idea is that you don't break URL paths after importing a database from local development to live, or visa versa. By using this tag it will automatically be relative to a given site and you'll never have to manually edit broken domain paths again. A classic example is with navigation links.
<ul id="navmenu"> <li class="articles"><a class="nopad" href="<txp:site_url />articles" title="Articles">Articles</a></li> <li class="photos"><a href="<txp:site_url />photos" title="Photographs">Photographs</a></li> </ul>
In your Head section of your HTML pages you might have a variety of links to locations relative to the local server, such as CSS files, Javascript files, a favicon and so forth. The relevance is similar to example #1, you want to ensure the paths are accurate relative to the server if a database has been imported from another location. Following is an example for the shortcut icon file (if you use one).
<link rel="shortcut icon" href="<txp:site_url />favicon.ico" />
<a href="<txp:site_url />download.txt">Download</a>
Structural Tags are a subcategory of the Tag Reference. They are tags that are used to 'group' content.
Download Category:Structural_Tags book
<txp:text />
The text tag is a single tag which is primarily used to return localized language strings from the txp_lang
database table.
Tag will accept the following attributes (case-sensitive):
name
column of the txp_lang
table. If the given item matches a key there, the contents of the respective item in the data
column will be returned. Otherwise, whatever you supply as the item
value is returned verbatim.<txp:older><txp:text item="older" /></txp:older>
<txp:older>older</txp:older>
which would always render the English text 'older', it replaces the contents with the value assigned to the name 'older' in the current language. So you would see a link with the word 'älter' if you were using German (de) as the Textpattern site language.Other tags used: older
<txp:thumbnail />
The thumbnail tag is a single tag that Textpattern will replace with the <img src="..." />
HTML tag matching the thumbnail image of the numeric id
assigned by Textpattern when the parent image was uploaded via the Textpattern Images panel.
Tag will accept the following attributes (case-sensitive):
class
attribute to apply to the image (or to the wraptag, if set).<
, >
and &
for the image's alt
and title
attributes.html
or unset.html
.height="0"
to turn off the output of a height attribute in the <img>
tag (thus the browser will scale the height if a width is used)id
attribute assigned to the image (or to the wraptag, if set).id
assigned at upload of the image to display. Can be found on the Images (panel). If both name
and id
are specified, name
is used while id
is ignored.0
.rel
attribute.0
.width="0"
to turn off the output of a width attribute in the <img>
tag (thus the browser will scale the width if a height is used)img
tag, specified without brackets.<txp:thumbnail id="23" />
align
deprecatedescape
changed from unset to html
link
and link_rel
addedhtml_id
, escape
and wraptag
added
<txp:title />
The title tag is a single tag which is used to return the title of the article being displayed. It is usually used in an article form.
Tag will accept the following attributes (case-sensitive):
<h2><txp:title /></h2> <div class="post"> <p><txp:author /> @ <txp:posted /></p> <txp:body /> </div>
Other tags used: author, posted, body
<txp:permlink><txp:title /></txp:permlink>
Other tags used: permlink
<txp:txp_die />
The txp_die tag is a single tag that will terminate normal page rendition and return the given status to the user agent (browser, search engine crawler, feed aggregator). An error page will also be returned to the user agent.
The status can be displayed by the error_status tag. A textual message can be associated with the error status and retrieved with the error_message tag. See also: Custom Error Pages.
Tag will accept the following attributes (case-sensitive):
301
, 302
, 307
, 404
, 403
, 401
, 408
, 410
, 304
, 503
, or any other valid status code503
.301
, 302
and 307
.<txp:txp_die status="404" />
<txp:txp_die status="301" url="http://example.com/new/location" />
url
attribute added
<txp:variable />
The variable tag is both a single and a container tag which sets or returns a user-defined global variable.
If used as a container, the result of the contained statements are assigned to the given variable name
.
<txp:variable> ...contained statements... </txp:variable>
Tag will accept the following attributes (case-sensitive):
For Textpattern version 4.3.0 and older, using the tag as a container does not assign a value if the container is empty. This can lead to unexpected results. These tags are equivalent:
<txp:variable name="test" /> <txp:variable name="test"></txp:variable>
These tags are not equivalent:
<txp:variable name="test" value="" /> <txp:variable name="test"></txp:variable>
In Textpattern versions 4.3.0 and older you should not use container-tag mode unless you know the tag contents will never be empty. This issue has been fixed in r3471 (v4.4.0+).
<txp:variable />
allows you to define constants at a single location (e.g., a Form, or even at the top of a Page template) and use them elsewhere later on, for instance as the email address for zem_contact_reborn's to
attribute or as the AdSense Publisher id for all three AdSense forms which are scattered throughout your template.
Somewhere at the very beginning of a template you would define names and values, just like you do on your desktop calculatorâ??s "memory" keys:
<txp:variable name="site-owner" value="john.doe@example.com" /> <txp:variable name="adsense-pub" value="pub-9999999" /> <txp:variable name="include_webfonts" value="yes" />
Later down the Page template or in a separate Form you can read the attribute values previously set:
<txp:zem_contact to='<txp:variable name="site-owner" />' />
Conditionals come in handy at times:
<txp:if_variable name="include_webfonts" value="yes"> <txp:css name="webfonts" format="link" /> </txp:if_variable>
Elsewhere :
<script type="text/javascript"> </script>
Other tags used: if_variable, css
There are two parts to making this work.
First a variable is created that stores the output of any Tag as the value (the name is arbitrary)...
<txp:variable name="foo" value='<txp:permlink />' />
Note: a Textpattern Tag, used as an attribute (a parsed attribute), must be surrounded with single quotes.
The variable "foo" can then be used as a conditional later in the code.
<txp:if_variable name="foo" value="example.com/bar/baz"> ...do this... </txp:if_variable>
The conditional is saying if there is a variable named "foo" having a specific value of "example.com/bar/baz", then output what is defined, i.e., "do this".
Other tags used: if_variable
Textpattern will build a three-column table where each row has the title of the article. If a number of articles is not divisible by 3 then empty cells will be inserted.
First, use an article_custom or article tag somewhere:
<txp:article_custom limit="100" section="article" form="tables" />
Form tables:
<txp:if_first_article> <table> </txp:if_first_article> <txp:if_variable name="trigger"> <txp:if_variable name="trigger" value="2"> <txp:variable name="trigger" value="3" /> </txp:if_variable> <txp:if_variable name="trigger" value="1"> <txp:variable name="trigger" value="2" /> </txp:if_variable> <txp:else /> <txp:variable name="trigger" value="1" /> </txp:if_variable> <txp:if_variable name="trigger" value="3"> <td><txp:title /></td> </tr> <txp:variable name="trigger" value="1" /> </txp:if_variable> <txp:if_variable name="trigger" value="2"> <td><txp:title /></td> <txp:if_last_article> <td></td> </tr> </txp:if_last_article> </txp:if_variable> <txp:if_variable name="trigger" value="1"> <tr> <td><txp:title /></td> <txp:if_last_article> <td></td><td></td> </tr> </txp:if_last_article> </txp:if_variable> <txp:if_last_article> </table> </txp:if_last_article>
In this case an article title was used but any article information could be inserted in the cells.
Other tags used: if_variable, if_first_article, if_last_article, title, else
<txp:yield />
The yield tag is a single tag which is used to return the inner content of the enclosing <txp:output_form> tag.
This tag has no attributes.
Given the following form named "example_form":
<div> This content is static and will be the same every time this form is invoked. <txp:yield /> </div>
We can invoke it twice with different inner content each time:
<txp:output_form form="example_form"> Invoking "example_form" with some inner content. </txp:output_form> <txp:output_form form="example_form"> Invoking "example_form" again, this time with different inner content. </txp:output_form>
And the result will be:
<div> This content is static and will be the same every time this form is invoked. Invoking "example_form" with some inner content. </div> <div> This content is static and will be the same every time this form is invoked. Invoking "example_form" again, this time with different inner content. </div>
Other tags used: output_form