Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-02-22 13:44:14

maica
Member
From: Utrecht (NL)
Registered: 2004-07-07
Posts: 15
Website

category not displayed

Sorry to bother you but I can’t get the following to work: I am having difficulties trying to use txp:if_article_category. When I try to use this tag, I always get the default option (defined after the txp:else-statement). I suspect that the category is not passed through. Or am I missing something very obvious? Like that this tag only works when every article is associated with a category? I’d appreciate some help with this.

I’m using Textpattern versie: 4.0.3 (r1188)

Last edited by maica (2006-02-22 13:48:41)

Offline

#2 2006-02-22 13:51:21

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: category not displayed

Where are you using the tag? This can only be used in an article form template.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#3 2006-02-22 14:05:05

maica
Member
From: Utrecht (NL)
Registered: 2004-07-07
Posts: 15
Website

Re: category not displayed

Ah uhm that could be it, thanks… I was trying to use it to display an extended menu when a certain category is selected, and a compact menu when that category (showing as a link in that menu) is not selected… I’ll try somethin different then.

Offline

#4 2006-02-22 14:07:00

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: category not displayed

If it’s for your page template try using <code><txp:if_category name=“categoryName”><txp:else /></txp:if_category></code> tags.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#5 2006-02-22 14:28:43

maica
Member
From: Utrecht (NL)
Registered: 2004-07-07
Posts: 15
Website

Re: category not displayed

If I do that I always get the default option… If I try to echo the pretext variable ‘c’ it doesn’t come up with anything, either. I am losing grip here…

Offline

#6 2006-02-22 14:35:40

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: category not displayed

Are you using the category Title instead of the Name?


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#7 2006-02-22 14:39:30

maica
Member
From: Utrecht (NL)
Registered: 2004-07-07
Posts: 15
Website

Re: category not displayed

No, I do this:

(txp:if_category name=“examples”) extended menu (txp:else /) compact menu (/txp:if_category)

and then I get the compact menu, no matter if the article displayed belongs to the category ‘examples’ or not.

Offline

#8 2006-02-22 14:44:20

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: category not displayed

Ah I see. That code I suggested will only work if you are viewing a category listing.

When we are looking at your page what are we seeing there? Is it an “individual_article” view or an “article_list” view. Remember that the front-page is a list even though it may only be a list of one.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#9 2006-02-22 15:01:39

maica
Member
From: Utrecht (NL)
Registered: 2004-07-07
Posts: 15
Website

Re: category not displayed

It’s a page in a section ‘work’. It has a menu list, one of the options is ‘examples’. When you click ‘examples’ the idea is that the menu expands, listing all the individual examples, and displaying a single article. That article would be the first article which is categorised under ‘examples’. I thought it could be possible to say to txp that when an article does not belong to a certain category, it should display the compact menu, but when the option is selected to view the examles (all belonging to the category ‘examples’) it should display the extended menu.

But by now I’m thinking myself towards a confused state of mind, I don’t hope I do that to you too ;)

Offline

#10 2006-02-22 15:25:04

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: category not displayed

Ha haaa. No, I have the idea now, but I’m not sure it’s possible. The tag you were using to start with, “if_article_category”, is the only one I know that can pick up the category of an article as opposed to a page, and that is restricted to use in article form templates. I’m stuck with this one!


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#11 2006-02-22 15:33:26

maica
Member
From: Utrecht (NL)
Registered: 2004-07-07
Posts: 15
Website

Re: category not displayed

Hmm of the little I know of php, there are variables that are declared before the structure of the page is made, and then there are other variables that are loaded in the page, the content. I thought that the global $pretext[‘c’] would pass the category before building the structure, but I think it doesn’t. I am making it a bit difficult for myself because I’m building the different submenu’s fo the different section using txp:php tags, because I like links to transform to plain text whenever the article that link represents is displayed.

Well anyway thanks a lot for thinking with me on this one. If I manage to do what I want I’ll post it ofcourse.

Offline

Board footer

Powered by FluxBB