Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Category dropdown?
I am trying to create a dropdown that has all categories that are used in a certain section in it. I know that there is txp:popup
but unfortunately one cannot customise the tag to a great extent.
The dropdown should link to an article_list for that particular category.
The code that I have right now is as follows
<form action="/themen/archiv/" method="get">
<label for="c">Themen</label><select name="c">
<option value="category name">Category Title</option>
</select>
<input type="submit" value="Anzeigen" />
</form>
When the form is submitted it sends the category selection to a article_custom
tag. (category attribute)
Unfortunately I cannot list categories in the <option
tags. The other problem is that I can’t get the variable out of the url into the category attribute.
Offline
#2 2009-05-31 20:50:49
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Category dropdown?
dl33 wrote:
Unfortunately I cannot list categories in the
<option
tags.
Why not? Is something like this useful for you?
Offline
Re: Category dropdown?
Els: yeah, that was the bit that I was missing… Thanks.
Offline
Re: Category dropdown?
Missing some other bits though:
<ul class="archive_list">
<txp:article_custom section="themen" limit="9999" searchsticky="0" category='<txp:php>echo $_GET["c"];</txp:php>'>
<li>
<a href="<txp:permlink />" title="<txp:title />"><span><txp:title /></span></a><br />
<span class="meta_date"><txp:posted/></span><txp:rss_unlimited_categories_filedunder wraptag="span" class="meta_category" section="themen" linktosection="themen" break=", "/>
</li>
</txp:article_custom>
</ul>
I can’t retrieve the variable from the URL via php to use in the article_custom
tag. (php echo returns nothing.)
I am using an article_custom
inside an article
that is displaying a sticky article. (Mainly because I want to keep the URL structure /section/title/?c=category)
Last edited by dl33 (2009-05-31 23:31:43)
Offline
#5 2009-05-31 23:42:55
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Category dropdown?
dl33 wrote:
I am using an
article_custom
inside anarticle
that is displaying a sticky article. (Mainly because I want to keep the URL structure /section/title/?c=category)
I don’t think <txp:category />
(or your php alternative) is going to work in an article context (even though the variable is in the URL). I can think of two ways to handle this:
- if the category in the URL is always category1 of your article, use
category='<txp:category1 />'
- use a plugin to fetch the URL variable: chs_if_urlvar or adi_gps (at least the latter is still maintained).
Offline
Re: Category dropdown?
1. I think that might be the problem: I am not using either category1 or 2 but the rss_unlimited_categories pugin.
2. I tried adj_gps, with the effect that nothing happens. So it is probably the rss_unlimited_categories problem.
Offline
#7 2009-06-01 00:04:05
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Category dropdown?
dl33 wrote:
So it is probably the rss_unlimited_categories problem.
Hmm… can’t help you with that I’m afraid. But maybe Adi can help you in the adi_gps plugin thread.
Offline
Re: Category dropdown?
Hmm, no worries. Thanks a lot for the help. Considering just telling the client that he can search for articles and that’s it… done, finito;-)
Offline
Pages: 1