Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
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