Mixing link types for navigation

Here is a small example of using the in-built Textpattern tags for developing a navigation system.

This system is useful if you need to generate a menu from various sources types – sections/categories/articles/linklists.

Enter some code on your page template

<ul class="height200">
<txp:section_list sections="news" wraptag="ul" break="li" class="" />
<txp:category_list wraptag="ul" break="li" class="" exclude="comedy" parent="Movies" section="entertainment" type="article" />
<txp:article_custom section="sports" form="article_custom_side_links" wraptag="ul" class="" break="li" sort="Title asc" limit="20" />
<txp:linklist wraptag="ul" break="li" category="External-Links" sort="linksort asc" class="" />

Breakdown of the tags

  • The section_list tag outputs a link to the News section
  • The category_list tag outputs all article categories from the Entertainment section
  • The article_custom tag outputs 20 articles from the Sports section
  • The linklist tag outputs all links from the External Links links category

On all tags, the class="" attribute is set to empty to prevent the tags setting default class names.

An example of this menu system may be found on this page – lower right hand side.

comments powered by Disqus