Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-10-26 16:10:34

jben.net
Member
From: Bath, UK
Registered: 2005-09-23
Posts: 10
Website

Force selected category

Hi,

How easy is it to force a category to be selected? If I was writing this with PHP I’d do something along the lines of:

if (!isset ($category))
{ $category = “Introduction”;
}

I’d also like to be able to display a full article if ‘Introduction’ is the selected category or a list of article links, though I haven’t decided exactly how they will be displayed, probably thumbnails with title, photo, date

I’m using the rdt_dynamenus plugin and sections to navigate through the site – more info here http://forum.textpattern.com/viewtopic.php?id=11575

thanks!

Jon

Last edited by jben.net (2005-10-26 16:10:47)

Offline

#2 2005-10-26 16:21:12

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Force selected category

You could use the <code><txp:if_category name=“CategoryName”><txp:else /></txp:if_category></code> in a page template to swap the output provided that the category is a part of the page URL.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#3 2005-10-26 16:28:40

jben.net
Member
From: Bath, UK
Registered: 2005-09-23
Posts: 10
Website

Re: Force selected category

hi,

Cool thanks I’ll try that. I also managed to do the exact same thing using some PHP at the top of the template, what if any are the cons of using php directly over txp tags?

Ta,

Jon

Offline

#4 2005-10-26 16:32:17

jben.net
Member
From: Bath, UK
Registered: 2005-09-23
Posts: 10
Website

Re: Force selected category

would I be able to force a particular category to be selected if no category has been selected by the user ??

Your suggestion answers my second question perfectly though.

Thanks,

Jon

Offline

Board footer

Powered by FluxBB