Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-03-17 04:44:50

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 596
Website

Link an article to another article (instead of linking plain files)

I have a weird situation:

Section: Product Brand A
  Article
    Custom Field: Product Model
    Custom Field: Product Year
Section: Product Brand B
  Same
Section: Product Brand C
  Same

Section: Product Awards
  Article
    Title
    Custom Field: Award File ID
    Custom Field: Related product's article ID (above)

For each product listing (Brand, Model, Year), I need to show the 3 latest awards for that product. But I’m not sure how to relate the awards to those exact sections/fields.

I thought about just using plain files — just add a file ID field to each product, and let authors input a comma-separated list. But I know Textpattern likes articles…would I be losing something if I did that? Could I somehow turn that comma-separated list of IDs into a list of files sorted by date?

The first method (articles) seems more flexible than files.

Thanks!

Last edited by maruchan (2011-03-17 04:50:25)

Offline

#2 2011-03-17 17:16:44

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Link an article to another article (instead of linking plain files)

maruchan wrote:

Could I somehow turn that comma-separated list of IDs into a list of files sorted by date?

Sure. “ file_download_list allows a comma-separated list for id, which you can sort by date. So, something like (untested):

<txp:file_download_list id='<txp:article_custom related_product='<txp:article_id />' break=","><txp:custom_field name="award_id" /></txp:article_custom>' />

Code is topiary

Offline

#3 2011-03-17 18:00:27

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 596
Website

Re: Link an article to another article (instead of linking plain files)

OK, that’s way cool, thanks Jeff. Yay! No extra section needed, it looks like.

Offline

Board footer

Powered by FluxBB