Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Extracting category when dealing with a category page?
Via $myspecialvar = $GLOBALS[‘thisarticle’][‘category1’]; I can read out the category that an article belongs to and re-use that information.
But how do I get the current category in the $myspecialvar when I am dealing with a category page?
I know about things like <txp:if_article_category name=“categoryname”> but I am not sure it will help.
Many thanks in advance.
Cheers,
Marcel
Offline
Re: Extracting category when dealing with a category page?
are you asking how to get the current category while in a category page? <txp:category /> ??? i’m not sure why you would want/need to extract this from that array.
Last edited by iblastoff (2008-02-20 12:48:01)
Offline
Re: Extracting category when dealing with a category page?
Hi iblastoff,
Just to put it in the $myspecialvar and then have a php script do something. Is that possible?
Cheers,
Marcel
Offline
Re: Extracting category when dealing with a category page?
sorry,
So something like
<txp:php>
global $myspecialvar;
$myspecialvar = “<txp:category />;
</txp:php>
would do the trick?
Offline
#5 2008-02-21 03:29:34
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Extracting category when dealing with a category page?
More like:
<txp:php>
global $myspecialvar, $pretext;
$myspecialvar = $pretext['c'];
</txp:php>
Offline
Re: Extracting category when dealing with a category page?
Thanks for stepping in Mary! It worked very well!!!
Nice to see you on Twitter also :-)
Cheers,
Marcel
Offline