Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-07-20 12:10:46

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 638
Website

Assign article to 5 categories and use if-category

Hi I’m working on a site for a car company, which I need to assign articles to 5 categories and then use if-category to display different content from the articles per category.

So this is what I done so far:

1. Installed the gbp_permanent_links plugin ,and created a permanent link rule of: section / category / title / category /

2. Installed the rss_unlimited_categories plugin ,and assigned an article to the 5 categories.

3. Used Els tip for using if_variable instead of if_category like this:

<txp:article>

<txp:variable name=“category_name” value=’<txp:page_url type=“c” />’ />

<txp:if_variable name=“category_name” value=“main”> car main page </txp:if_variable>

<txp:if_variable name=“category_name” value=“gallery”> car gallery page </txp:if_variable>

<txp:if_variable name=“category_name” value=“engines”> car engines page </txp:if_variable>

<txp:if_variable name=“category_name” value=“technologies”> car technologies page </txp:if_variable>

<txp:if_variable name=“category_name” value=“accessories”> car accessories page </txp:if_variable>

</txp:article>

Now when I’m trying to visit the article page with a specific category:
example.com/car-section/series-category/car-name-article-title/main(another-category)
unfortunately it doesn’t work.
It works just fine without the rss_unlimited_categories plugin, but I do need to assign the article to 5 categories so I do need a way to select these 5, any ideas please? or any ideas how to make it work with the rss_uc plugin?

BTW: If I can fake these pages in an other way not with categories it will still be great, but it must be a server-side and not front-end by using jQuery-tabs or so.

It’s my first-time using TXP at work and not only as freelance at home :)

Last edited by THE BLUE DRAGON (2011-08-08 18:09:31)

Offline

#2 2011-07-20 12:31:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,945
Website GitHub

Re: Assign article to 5 categories and use if-category

Two things:

  1. IIRC, rss_uc doesn’t work with /category URLs; you can only list cats using <txp:rss_uc_filed_under>.
  2. I thought the category / gbp_permanent_links bug was fixed so you should be able to use if_category under 4.40+. Maybe I’m wrong, as I’ve not tried it.

I think you might be out of luck with rss_uc.

There’s always smd_tags, which you can configure to operate in a similar way to rss_uc (i.e. offer a fixed set of tags). It will allow site.com/tags/tag-name URLs which you can make list all articles (or other types) that have been assigned to those tag. So while it won’t offer you /category in the URL, you can probably get the desired functionality, and you won’t even need gbp_pl to do it :-) (EDIT: oh, and you can import your rss_uc cats so you won’t have to redo them all)

Actually, I’ve not tried it but you might be able to use category as a trigger word, though I suspect Txp will complain. Might be something to try if keeping the /category in the URL is important to you.

It is heavy on the queries right now, but I’ll be working on that soon to ease the server load.

Last edited by Bloke (2011-07-20 12:35:54)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2011-07-20 13:33:27

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 638
Website

Re: Assign article to 5 categories and use if-category

Bloke wrote:

  1. I thought the category / gbp_permanent_links bug was fixed so you should be able to use if_category under 4.40+. Maybe I’m wrong, as I’ve not tried it.

Did this fix came out after TXP v4.4.1 ? (which the one I use)
I will give it a try.

There’s always smd_tags, which you can configure to operate in a similar way to rss_uc (i.e. offer a fixed set of tags). It will allow site.com/tags/tag-name URLs

Will I be able to create URLs as: /section/category_OR_tag-name/article-title/tag-name ?
If I understand it right smd_tags it’s like a better replacement for the regular categories-system?
What I need is to have the section which is “model” then the series name “blabla” the car name which is the article-title for example “TT” and another parameter to display specific content from that article for example “gallery” which will output the article-image content. (for example)

Offline

#4 2011-07-20 13:51:38

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,945
Website GitHub

Re: Assign article to 5 categories and use if-category

THE BLUE DRAGON wrote:

Did this fix came out after TXP v4.4.1 ? (which the one I use)

Nope. Its was in 4.4.0. Dunno if it fixed it, but it was supposed to!

Will I be able to create URLs as: /section/category_OR_tag-name/article-title/tag-name ?

No. Not without gbp_pl. Of which I’m not sure how well it plays with smd_tags, sorry. In theory gbp_pl should be able to permit that structure and pass smd_tagname and smd_tagtype to my plugin so you can display the relevant matches. Incidentally, smd_tags offers site.com/tags/tag1|tag2|tag3|… to allow you to show information for any of the listed tags. I haven’t done tag1+tag2+tag3 yet (combinatorial tag selection) as I couldn’t figure out the code.

If I understand it right smd_tags it’s like a better replacement for the regular categories-system?

Well, better is a subjective term :-) But yeah the idea is that it offers unlimited taxonomy for all content types.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB