Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: <txp:mdm_if_category>
The plugin I wrote simply passes out the content between the start and end tags, so as written any txp tags inside do not get handled. What should be done is to take the content between the tags and pass it back into textpattern for further evaluation.
How that is done, I don’t know. I haven’t looked into it, and am busy on several other higher-priority things. If someone knows what function or bit of code I need to have the content further evaluated, please let me know and I’ll revise the plugin to use that.
Offline
Re: <txp:mdm_if_category>
You can tell txp to parse the enclosed text with a call to <code>parse($text);</code> in place of where you return the enclosed code.
Offline
Re: <txp:mdm_if_category>
In the meantime I used a workaround with inline PHP which works well for me. I wish I was a better PHP coder so that I could put the workaround into some abstract PHP code and make a plugin out of it.
The only thing I have manged on my own so far is a “plugin” to detect which browser the user is running and deliver custom content.
Offline
Re: <txp:mdm_if_category>
Okay, the plugin has been updated. Version 0.4 of the mdm_if_category plugin is now available.
Offline
Re: <txp:mdm_if_category>
Great. Thank you very much. This makes things much easier.
Offline
#36 2004-11-16 14:06:55
- apo
- Member
- From: Germany
- Registered: 2004-10-27
- Posts: 53
Re: <txp:mdm_if_category>
can anyone provide a link? splatbang seems to be down or something…
Offline
Re: <txp:mdm_if_category>
apo,
Works fine for me now, it was probably just a temporary down period.
Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1
“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu
Offline
Re: <txp:mdm_if_category>
What about category heirarchy? I want to show/hide content but it could be any of a list of subcategories. Could some conditions be added for the parent/child relationship of categories?
Like say I have
- Cat1
- CatA
- CatB
- Cat2
I want to do the condition for if the category is any child of Cat1, but not nesessarily in Cat1 itself.
Thanks.
Rayne
Last edited by rayne (2004-12-01 21:44:03)
Rayne
mama love
Offline
Re: <txp:mdm_if_category>
Never mind. I reworked the categories so that I don’t have to do this.
Rayne
mama love
Offline
Re: <txp:mdm_if_category>
Hello,
I have 2 categories ‘Incidentals’ and ‘Miscellaneous’ which are both in a section called ‘Meanderings’. I have page titles for all my sections that are called by CSS on the body tag.
On my ‘Meanderings’ page template I use txp:mdm_if_category like this…
<txp:mdm_if_category category="incidentals">
<body id="incidentals">
</txp:mdm_if_category>
<br />
<txp:mdm_if_category category="Miscellaneous">
<body id="meanderings">
</txp:mdm_if_category>
This works fine until I try to view an article and the title disappears. Can anyone suggest a workaround for this? – other than have a separate section for one of my categories.
Cheers
Last edited by Martagnan (2004-12-02 09:47:35)
Offline
Re: <txp:mdm_if_category>
this is exactly what I’ve been looking for … thanks man!!!!!
Offline
Re: <txp:mdm_if_category>
This plugin is great – thanks!
However I have a problem. I’m trying display some text only if the current category is not matched. This works fine, but the text also appears even if there is no category being viewed at all.
This is my code:
<txp:mdm_if_category category="!my category"> my text </txp:mdm_if_category>
I’d like it if this worked only if there was a category in use. Any suggestions?
Forget your dreams
Offline
#43 2004-12-18 21:34:16
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: <txp:mdm_if_category>
If you don’t have too many categories, you could use something like this: category=“Category1,Category2,Category4”, thus excluding Category3.
Offline
Re: <txp:mdm_if_category>
Thanks doggiez, but I need this to work without manually having to enter all my categories.
I’ve managed to hack the plug-in now so it works.
Forget your dreams
Offline
Re: <txp:mdm_if_category>
Thanks a lot for this plugin. I’m with Case though, I wish it would just know what category is being displayed so I wouldn’t have like 12 copies of a whole bunch of code.
Offline