Improved section and category nav tags

New in the 4.0 branch: improved section, category navigation tags.

The attributes for <txp:section /> have been expanded, and there’s a new <txp:category /> tag with similar attributes.

You can use the new attributes to create a navigation list with a specific order, for example:

<ul>
  <txp:section wraptag="li" link=1 title=1 name="about" />
  <txp:section wraptag="li" link=1 title=1 name="articles" />
  <txp:section wraptag="li" link=1 title=1 name="news" />
  <txp:section wraptag="li" link=1 title=1 name="contact" />
</ul>

or:

<ul>
  <txp:category wraptag="li" link=1 title=1 name="products" />
  <txp:category wraptag="li" link=1 title=1 name="weather" />
  <txp:category wraptag="li" link=1 title=1 name="photos" />
</ul>

Both tags are sensitive to the current URL section (though this can be overridden by specifying either in the attributes). <txp:section /> retains its old behaviour, using the current article’s section when used in an article form.

Comments

  1. Now that’s cool and will prove very handy :-D One thing that would make sense also is integrate the hl_current_section and maybe expand it to categories (it’s SO useful)

  2. A little late to the party here but this is really awesome. In addition to David’s suggestion, how about classname="classname", which would apply classname to the li tag for that item. Don’t need to go into the benefits of doing this from the CSS image repalcement possibilities perspective.

  3. Nice!

    I usually hardcode the nav, because I have sections that arent managed by TXP (like a catalog by osCommerce), and until now, as far as I know, there werent a solution (nor by default nor by plugins) to intercalate a li (with a link to a page not managed by TXP) in a section list generated by TXP or a plug-in.

    Wait…

    The ako_nav plug-in can do that – I have used it for months but didnt realize that. :D

    BTW, this new improved section tag seems will be nice, but when it generates a link, can it pass the title attribute to the a tag?

  4. doesnt link=1 title=1 should be link=”1” title=”1”?

  5. thx for the information necessary to me.. and no comments©

  6. But txp:category title=“1” doesnt´t work with image category.

Commenting has expired for this article.