Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-06-19 13:36:41

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

list other articles which share category1 value

…in an article page.

The actual value of category1 isn’t known, as extra categories may be added after I finish the site, so I can’t hard-code it into an <code><txp:if_article_category></code> attribute.

chh_related_articles is almost there, but it doesn’t allow you to specify either category1 or category2, and I need to ignore category2.

anyone know another way?

Offline

#2 2006-06-21 01:53:36

guiguibonbon
Member
Registered: 2006-02-20
Posts: 296

Re: list other articles which share category1 value

That plugin is pretty well written and I’ve edited it a few times myself to add certain functionalities, it’s all fairly easy. So, if you’re comfortable with php, that’s what I’d do.

Offline

#3 2006-06-21 07:18:50

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: list other articles which share category1 value

if you’re comfortable with php

if only… it would save me and the forum angels a lot of time!
:o)

Offline

#4 2006-06-21 14:44:48

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,126
Website GitHub

Re: list other articles which share category1 value

can you not use txp:article_custom and constrain to the current category: zem detailed some ways of using article custom on his homepage and to use the current category you will want to use the category tag within the article_custom tag. Here describes how you do that (replace s in the example with c for category).


TXP Builders – finely-crafted code, design and txp

Offline

#5 2006-06-21 16:40:10

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: list other articles which share category1 value

Hi Jakob
This is to go in an article page, where the global category isn’t set (as I understand it).
Do you first mean constrain to the current article category? If so, I can’t do that because there are two, and I need to ignore one of them.
Does that make sense?

Offline

#6 2006-06-21 19:06:44

guiguibonbon
Member
Registered: 2006-02-20
Posts: 296

Re: list other articles which share category1 value

Ok, poor boy :0), purely out of pity for your desperate situation, I had a look at what could be done php-wise with the plugin. Would it be good enough if he actually looks only at the cat1 of your current article, but displays a list of articles which have that value in cat1 OR/AND cat2 ? This would be ok if your never use the cats in cat1 for cat2 (don’t know if that makes any sense), in which case, replace the plugin with this (changes highlighted).
From there on, you can use relation=“category1->category” in the tag. Or category2->catergory.

If you do use the same values in category 1 and 2, you’ll have to give me a tiny bit more time.

Last edited by guiguibonbon (2006-06-21 19:27:47)

Offline

#7 2006-06-21 21:57:48

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: list other articles which share category1 value

Immense!
I’m very impressed and even more grateful. Seriously.
:o)

Offline

#8 2006-06-21 21:59:13

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: list other articles which share category1 value

and no, it shouldn’t ever need to use the same cats in cat1 & cat2… so this is purrrfect
geddit?

Offline

Board footer

Powered by FluxBB