Content last modified Monday 3 September 2018
hop to #bottom
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:


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

You know you want to visit the Archives.
Published with Textpattern