Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-10-05 12:27:40

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,167
Website

adi_cat_menu – Category & article menu

Summary

adi_cat_menu will produce a menu of categories and their articles.

Once installed and activated, you’ll get a new tag <txp:adi_cat_menu /> to output the category & article menu.

See the help supplied with the plugin, or have a look online.

Background

This plugin was written in response to a request from Kevin Potts.

Functionality

By default, adi_cat_menu will produce a menu containing all article categories together with the articles that belong to them. However a parent category can be specified, using the parent="category name" attribute, to restrict the list.

For example, <txp:adi_cat_menu parent="Parent1" /> might produce:

  • Category A
    • Article A1
    • Article A2
    • Article A3
  • Category B
    • Article B1
    • Article B2
    • Article B3
  • Category C
    • Article C1
    • Article C2
    • Article C3

By using the active_only="1" attribute only articles in the currently active category will be listed. In this case, if no category is active then a simple list of categories is generated, without any articles.

Version History

  • 0.6
    • TXP 4.6 tag registration
  • 0.5
    • new attribute: ‘list_empty_cats’ (for floodfish)
    • new attributes ‘list_id’ & ‘list_id_prefix’ (for floodfish)
    • new attributes: ‘wraptag’, ‘wraptag_id’, ‘wraptag_class’
    • new attribute: ‘active_parent’ (for kbarlow)
  • 0.4
    • new adi_cat_menu attributes: ‘link’ (for jpdupont), ‘article_form’ & ‘rss_article_form’ (for floodfish)
    • enhancement: extended ‘categories’ & ‘exclude’ functionality to section sensitive mode
    • fix: suppress empty <ul></ul> (e.g. when no categories found in section sensitive mode) (for jpdupont)
  • 0.3
    • enhancement: restored ‘section’, ‘this_section’ attributes & extended functionality to cover article lists
    • enhancement: restored ‘exclude’ attribute functionality
    • enhancement: restored ‘categories’ attribute functionality
    • new adi_cat_menu attribute: section-sensitive
  • 0.2
    • rss_unlimited_categories support
    • sort option
  • 0.1
    • initial release

Requirements

Tested in:

  • Textpattern 4.0.5, MySQL 5.0.45, PHP 5.2.4
  • Textpattern 4.0.6, MySQL 5.0.45, PHP 5.2.4
  • Textpattern 4.0.7 (r2975), MySQL 5.0.45, PHP 5.2.4

Download & Installation

Download adi_cat_menu and install the plugin in the usual way. At least one form will have to be created (see plugin help for details).

Bugs & Limitations

  • when in rss_unlimited_categories mode the currently active article is not listed

Let me know if you find any other problems.

Feedback

Comments are most welcome.

Credits

Much code has been shamelessly plundered from standard Textpattern tags.

Thanks to Kevin Potts for sponsoring this plugin. I’m now the proud owner of a signed copy of his book: Web Design and Marketing Solutions.

Thanks and respect and apologies to Christophe Beyls for the code that I’ve stolen from cbs_category_list to implement the section sensitivity gubbins.

Crumbs of comfort for a developer

If you find this plugin useful and would like to experience contentment every time you use it, please consider donating to the Textpattern development team.

Last edited by gomedia (2015-06-15 02:53:39)

Offline

#2 2008-10-05 12:51:10

kevinpotts
Member
From: Kansas City
Registered: 2004-12-07
Posts: 364
Website

Re: adi_cat_menu – Category & article menu

Yes, I am guilt of bugging Adi for this, and he did an amazing job of producing what I consider an incredibly useful plugin. I am using it in a large development project right now, and he single-handedly saved me about ten hours of manual menu creation. Highly recommended.

Offline

#3 2008-10-05 15:19:40

kemie
Plugin Author
From: mexico<-->sweden
Registered: 2004-05-20
Posts: 495
Website

Re: adi_cat_menu – Category & article menu

this sounds awesome and just what i need for an upcoming project!


~~~~~~~~~~~~~| monolinea.com | pixilate.com | istockphoto.com/kemie |~~~~~~~~~~~~~

Offline

#4 2008-10-06 09:32:29

jpdupont
Member
From: Virton (BE)
Registered: 2004-10-01
Posts: 590
Website

Re: adi_cat_menu – Category & article menu

Awesome ! Did your plugin work with rss_unlimited_categories plugin ?
(I try this on a site with unlimited categories. I get the list of the categories, no articles.)

Offline

#5 2008-10-06 09:54:23

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,167
Website

Re: adi_cat_menu – Category & article menu

jpdupont wrote:

Awesome ! Did your plugin work with rss_unlimited_categories plugin ?
(I try this on a site with unlimited categories. I get the list of the categories, no articles.)

The requirement wasn’t for it to work with rss_unlimited_categories and I guess it doesn’t! However, it’s something I can look into.

Offline

#6 2008-10-06 15:27:39

kevinpotts
Member
From: Kansas City
Registered: 2004-12-07
Posts: 364
Website

Re: adi_cat_menu – Category & article menu

I hadn’t tried that in my beta testing, but I can confirm it plays very nicely with gbp_permanent_links when I do /section/category/title structures.

Offline

#7 2008-10-08 12:07:25

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,167
Website

Re: adi_cat_menu – Category & article menu

Version 0.2 is now available and provides:

  • rss_unlimited_categories support
  • sort option

See post #1 and the plugin help for details.

Offline

#8 2008-10-16 13:00:32

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: adi_cat_menu – Category & article menu

This plugin would be perfect if only I could get it to generate category and article links that are limited to the current section (rather than the entire site). Do you foresee this being added in a future version?

UPDATE: It turns out you can restrict the output to a certain section by using the undocumented this_section attribute. The attribute defaults to 0 (false), but setting it to 1 causes the list to be limited to the current section.

Last edited by Logoleptic (2008-10-16 18:18:20)

Offline

#9 2008-10-16 21:25:57

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,167
Website

Re: adi_cat_menu – Category & article menu

Logoleptic wrote:

It turns out you can restrict the output to a certain section by using the undocumented this_section attribute.

Well spotted Adam. This plugin is based on the standard <txp:category_list /> tag so attributes ‘section’, ‘this_section’ & ‘type’ are available in addition to the documented ones. I will list these in the help in a later version. In the meantime refer to <txp:category_list /> for details.

Offline

#10 2008-10-24 08:10:57

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: adi_cat_menu – Category & article menu

I found myself in a situation where I needed to exclude a category from the navigation list generated by this plugin. A few small edits did the trick, since the mechanics of category exclusion are already in this plugin thanks to its <txp:category_list /> ancestry. If anyone needs similar functionality, you’ll need to make two changes to the adi_cat_menu function.

First, add the attribute to the plugin’s supported attributes, with a default value of no exclusions:

extract(lAtts(array(
  'class'     => 'cat_menu', // class applied to top level <ul>
  'menu_id'   => '',        // CSS ID for top level <ul>
  'active_class' => 'active_class',  // class applied to active <li>
  'parent'    => '',        // category parent
  'exclude' => '',          // PATCH: category exclusion
  'sort'      => '',        // category sort options
  'messy_url'   => '0',     // force links to be output in messy URL format
  'article_attr'  => '',    // attributes to pass to article_custom
  'active_only' => '0',     // only show articles in currently active category
  'rss_unlimited' => '0',   // rss_unlimited_categories mode
  'section' => '',          // leftover from TXP category_list
  'this_section' => 0,      // leftover from TXP category_list
  'type'   => 'article',    // leftover from TXP category_list
  'debug'  => '0',
), $atts));

Next, one more change line to make the new feature effective. Edit this line:

$exclude = $parent;

so that it reads like this:

$exclude = $parent . ',' . $exclude;

Offline

Board footer

Powered by FluxBB