Attributes · 27.03.04
Many of the TXP tags can have attributes, which will be similar to common XHTML attributes on their syntax. Each tag can has its own attributes so, we’ll see them when we describe the tag they can be attached to.
But there are several attributes which can be used with a considerable number of TXP tags, keeping always the same significance. Due to this, and in order to prevent redundancy across this manual, seems logical to describe them together in any place.
This don’t mean that we can use these attributes with all TXP tags, but only with the ones listed after each attribute description.
A lot of TXP tags are intended to show some kinda of lists: lists of links, articles, comments, ..., the limit attribute allow us to specify the maximun number of items to show on one of this TXP lists of things. The value must be a number.
So, for example, we can set the max number of articles to show on your default page by writting: <txp:article limit=”5” />
Tags which can have this attribute are: article, article_custom, linklist, recent_articles, recent_comments and related_articles.
Sometimes you need to add some “label” to a TXP element like, for example, a popup, (a popup is the XHTML select which comes, by default, at the right column of the TXP default page, providing your page visitors with a fast way to find and go to any section of your site).
In order to add your custom label to the elements you want, you have only to specify that label as the value for the label attribute for those elements tags. Returning to the sections popup: <txp:popup label=”Browse Site Sections” type=”s” />
This attribute offers us the possibility of place our tag contents inside an XHTML tag of our election, without the need of specify this tag enclosing our TXP tag.
Why?, because using this tag, you will asure that if the TXP tag is replaced by nothing, you will not have empty XHTML elements in your resulting document.
Let’s say we want to place our previous example inside a <p></p> tag: <txp:popup label=”Browse Site Sections” type=”s” wraptag=”p” />.
Important: Note that we pass to the wraptag attribute the name of the XHTML tag, without the < & > signs !!!.
What about the possibility of specify a tag after each item on a list?. The break attribute comes to the rescue.
Use it to say TXP what tag it must place after each list item.
Custom lists [Or “The graceful combination of break & wraptag”]
Ok, let’s assume you’re a standards advocate who want to write semantical XHTML list for your links. The must question: How can I use wraptag and break combined to buil them?.
Fortunately, Dean thinked it before us. Add to your list tag the attributes break=”li” wraptag=”ul” and, with a kind of TXP magic, your lists are done!.
* * *