Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
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
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
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
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
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
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
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
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
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
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
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
Pages: 1