Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2004-06-02 19:44:55

mattmoss
Member
Registered: 2004-03-29
Posts: 23
Website

Re: <txp:mdm_if_category>

Since it appears that the 1.19 release is just about ready, I’m going to hold off on upgrading to 1.18. Once 1.19 comes up, I’ll upgrade to that and retest mdm_if_category and get it working under 1.19.

Offline

#14 2004-06-02 19:55:45

rajo
Member
Registered: 2004-03-13
Posts: 43

Re: <txp:mdm_if_category>

thank you

Offline

#15 2004-06-03 04:39:53

ThrokFeroth
Member
From: Malaysia
Registered: 2004-02-28
Posts: 12
Website

Re: <txp:mdm_if_category>

Is there a way to modify this in order to become if_section?

Offline

#16 2004-06-03 14:29:17

mattmoss
Member
Registered: 2004-03-29
Posts: 23
Website

Re: <txp:mdm_if_category>

> Is there a way to modify this in order to become if_section?

Probably like this:

<pre> function mdm_if_section($atts, $snip) { $section = null; if (is_array($atts)) { // extracts $section if present extract($atts); } return (is_null($section) || gps(“s”) == $section) ? $snip : “”; }
</pre>

But I haven’t tested it…

Offline

#17 2004-06-03 15:26:24

ThrokFeroth
Member
From: Malaysia
Registered: 2004-02-28
Posts: 12
Website

Re: <txp:mdm_if_category>

Thanks for helping, but I don’t think it works…

Offline

#18 2004-06-03 16:12:52

Manfre
Plugin Author
From: North Carolina
Registered: 2004-05-22
Posts: 588
Website

Re: <txp:mdm_if_category>

It probably is not working because if you just replaced the plugin text of mdm_if_category, then tp may not load it since it is not registered as mdm_if_section. I have an if plugin in the works that will work with most of the page related values.

Offline

#19 2004-06-03 22:38:29

santheo
Archived Plugin Author
From: Chicago
Registered: 2004-05-27
Posts: 62
Website

Re: <txp:mdm_if_category>

This is very nice.

One request: the ability to handle the condition “show if any category is selected”. Perhaps by setting the category property to a space? Or some character that’s not allowed in Category names? Or, more simply, change the function of the first scenario — no category property is defined — to represent this condition.

Alternative take: implement an [else] tag, though I don’t know if that’s possible.

Offline

#20 2004-06-08 03:31:23

mattmoss
Member
Registered: 2004-03-29
Posts: 23
Website

Re: <txp:mdm_if_category>

I just downloaded TXP 1.19 and decided to make sure the mdm_if_category plugin was still working.

So far, it seems to work. I haven’t tinkered with any of 1.19’s category changes yet, so that remains to be seen.

I added a bit of code so that if you use category=““, then the enclosed text will show when any category (except the empty category) is selected. That is, category=”” does the opposite of category=”“. (See earlier in this thread for an example of the latter.)

The plugin is at the same place as before

Offline

#21 2004-06-10 23:30:58

schussat
Plugin Author
Registered: 2004-02-24
Posts: 101
Website

Re: <txp:mdm_if_category>

I’m sure that the answer to this is right in front of me, but I can’t track down the tag. This plugin should work perfectly to add a slightly-modified header to a page when browsing by category, as in <txp:mdm_if_category category="*">Browsing by CATEGORY</txp>.

But I can’t seem to find the tag to return the current category — not per article, because this is outside of the <txp:article ...> part of the page, but for the entire page.

Is this right in front of me? Thanks.


-Alan

Offline

#22 2004-06-11 02:54:07

mattmoss
Member
Registered: 2004-03-29
Posts: 23
Website

Re: <txp:mdm_if_category>

If you look at the source code to mdm_if_category, you’ll see I call gps(“c”) which gets me the category name to compare against the category attribute.

However, that’s a PHP function call, and I don’t think you can simply drop that into your page template. I am not aware of any tag that gives you the current category name. It would require a plugin…

Offline

#23 2004-06-11 03:11:15

mattmoss
Member
Registered: 2004-03-29
Posts: 23
Website

Re: <txp:mdm_if_category>

I just whipped up another plugin for what you wanted, &lt;txp:mdm_category_name /&gt;; look for it in a separate forum thread by that name.

Offline

#24 2004-06-11 14:26:35

jonhicks
Member
From: Oxfordshire UK
Registered: 2004-03-22
Posts: 256
Website

Re: <txp:mdm_if_category>

This is quality! Thanks for this useful plugin! I’ve ended up using this quite a lot!

At the moment I have 4 categories and I just want to separate one of the for special treatment. The other 3 all output the same content. At the moment I’ve listed each category like so:

<code>
<txp:mdm_if_category category=“special”>
different code here needs special treatment
</txp:mdm_if_category>

<txp:mdm_if_category category=“cat1”>
same code here
</txp:mdm_if_category>

<txp:mdm_if_category category=“cat2”>
same code here
</txp:mdm_if_category>

<txp:mdm_if_category category=“cat3”>
same code here
</txp:mdm_if_category>
</code>

Is there a smarter way to do this up? E.g, can you list categories in the attribute, separated by commas?


Cheers,
Jon VC#9

Offline

Board footer

Powered by FluxBB