Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
marios
About It:
Rate it:
  • Helpful?
  • 2 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

Section and Category Pull-down Menus, Part II

In continuation to Mary’s previous article:
Section and Category Pull-down Menus, here is how to have these as simple category selects, provided, you have one article assigned per category.

The only basic difference here is the tag used for the options and the sorting criteria.(which can also be omitted in this case here or adapted to your likings. )
Here I used the first category to have as select option, based on section specific filtering.
(The valuses remain the permlinks, as in the previous example)

For example:

In Page Template:

<form action=""><fieldset><legend>View Galleries by </legend><label for="category">Category</label> <select onchange="document.location=options[selectedIndex].value;"> <option value="" selected="selected">Sort by category</option><txp:article_custom section="lightroom" form="gen_gallery_title_jump_cat" limit="5" sort="category1 asc" /> </select></fieldset></form>

And the article custom form looks like that:

<option value="<txp:permlink />"><txp:category1 /></option>

In the same way of course, you can have title, keywords, ID, date or cutom_field specific selects:

Examples:

By Date:

<option value="<txp:permlink />"><txp:posted format="%b %d %Y" /></option>

By keywords:

<option value="<txp:permlink />"><txp:keywords /></option>

By custom Field:

<option value="<txp:permlink />"><txp:custom_field name="imgcat" /></option>

NOTE: Just adapt the sorting criteria on your article_custom tag to your basic needs .
For instance in the last case above, I’d use the following attribute values:

sort="custom_1 asc"

To prevent, that no emty options show up, in case there was no entry for the specific field, use either the TXP native conditionals, wherever that is necessary or possible, or use the chh_if_data plugin.

The most ideal scenario, for building all sorts of forms, like these dropdown selects, would be to pass the form and sort attributes over to the article custom_tag, using another article_custom tag,
but I haven’t found a way to do this.

Article Request Count:
Posted here:
04 Jan 2007
Article modified:
04 Jan 2007

Comments/questions? Leave a message in the form.

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern