Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-03-01 22:07:51

bankholdup
Member
Registered: 2005-12-09
Posts: 14

create a category popup list using only cat. 1 and not cat. 2

when you create an article you can assign 2 categories to it.

i want to make a category popup list displaying the first categories only (cat. 1), not the second (cat.2)

is this possible?

Offline

#2 2006-03-01 22:29:05

Elenita
Member
From: Falls Church, VA
Registered: 2004-05-16
Posts: 407
Website

Re: create a category popup list using only cat. 1 and not cat. 2

<a href=“http://textpattern.net/wiki/index.php?title=Txp:category1_/”>txp:category1 /</a>

Note the link attribute.

Offline

#3 2006-03-02 01:47:07

bankholdup
Member
Registered: 2005-12-09
Posts: 14

Re: create a category popup list using only cat. 1 and not cat. 2

thanks for your help so far!

there doesnt seem to be a method for creating a popup list though… i want the popup list to sit within my default template.

basically what i am trying to achieve is…

the ability to add 2 categories to an article and have only the first one displaying in a popup list that will sit in a template.

the first category will be a place name, the second will be industry type, i only want the popup to display the place names so that when a visitor selects a place name from the list the articles for that category will be returned.

Offline

#4 2006-03-03 02:56:06

Elenita
Member
From: Falls Church, VA
Registered: 2004-05-16
Posts: 407
Website

Re: create a category popup list using only cat. 1 and not cat. 2

Maybe I just haven’t gotten enough sleep, but I’m not sure what you’re trying to do (besides having a popup of some sort). Could you please clarify what you mean by “a popup list that will sit in a template?”

Offline

#5 2006-03-05 16:24:42

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,771
Website

Re: create a category popup list using only cat. 1 and not cat. 2

If I understand you correctly you want to restrict <code><txp:popup /></code> to a certain category group. Whilst I don’t think that tag will do that, you could achieve it another way:

If you arrange your place-name categories as sub-categories of a parent-category and use <code><txp:category_list parent=“your-parent-category” break=“li” wraptag=“ul” /></code> you can obtain an unordered list of just those categories, rather than all categories. This you can style how you want, or as a popup à la suckerfish dropdown. Here are two other different approaches also using unordered lists: taming the select or this styled unordered list (see entry at end of pick a category for the download).

Alternatively, it should be possible to build a select-option list manually using using <code><chh:article_custom category=“your-parent-category” children=“y” /></code> together with <code><txp:if_different /></code> as described at the end of this faq article by zem:

In your page template add <code><txp:output_form form=“select-popup” /></code> where you want the popup to appear:

Make a form called “select-popup” with a type of “misc” as follows:

<code>
<form name=“category_select” action=”“> <label for=“c”>Place Name:</label> <select name=“c” title=“to place name”> <txp:chh_article_custom category=“your-parent-category” children=“y” listform=“select-option” sortby=“category1” sortdir=“asc” /> </select>
<input type=“submit” value=“Go” />
</form>
</code>

Make a further form called “select-option” with a type of “article” as follows:

<code>
<txp:if_different>
<option value=”<txp:category1 />”><txp:category1 title=“1” /></option>
</txp:if_different>
</code>

This lists only those categories with articles in them, avoiding the need for a “no articles found” situation.

There are other category listing plugins which I’ve not tried and may be able to do some of the above too: cbs_category_list or stw_category_tree

Last edited by jakob (2006-03-05 17:52:15)


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB