Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-02-20 12:07:47

zeeforel
Member
From: Nieuwerkerk a/d IJssel, NL
Registered: 2004-10-16
Posts: 92
Website

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

#2 2008-02-20 12:26:54

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

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

#3 2008-02-20 13:00:44

zeeforel
Member
From: Nieuwerkerk a/d IJssel, NL
Registered: 2004-10-16
Posts: 92
Website

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

#4 2008-02-20 13:57:13

zeeforel
Member
From: Nieuwerkerk a/d IJssel, NL
Registered: 2004-10-16
Posts: 92
Website

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

#6 2008-02-21 21:16:40

zeeforel
Member
From: Nieuwerkerk a/d IJssel, NL
Registered: 2004-10-16
Posts: 92
Website

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

Board footer

Powered by FluxBB