Jump to content

Calling Current Record's Prefix Tag to Return 'Related Articles' List


Recommended Posts

I have two databases: info and news. The news database has a couple of categories (features, which has two subcategories [reviews and interviews], games and comics). I want to be able to call the prefix tag of the 'info' page that a user is currently browsing, and use that tag to seek and return a list of records from the 'news' database that is also tagged with the same prefix tag (the news record does not need to have the tag as prefix, just as a regular tag). I want to display this list of records in three different ways:

  • A 'related news' section, which returns all records in the 'news' database with the exception of any records in the 'features' category (and its subcategories).
  • A 'related features' section, which returns all records in the 'news' database that are categorised under 'features' category (and its subcategories).
  • A 'reviews' section, which returns only records in the 'news' database that are categorised under the 'features > reviews' category. 

I figure that calling the current info page's prefix tag is the most accurate way of returning results to display on the page. I have looked into going the Reciprocal Items route instead, but this has some limitations; I can't seem to organise the returning results (by most recently posted, most popular etc) and this seems to pull any and all Reciprocal Items on ANY Pages database, not just 'news'. I also can't seem to return by specific category either.

I'm pretty new to building out custom template stuff on IPB (I'm more used to working with CSS), so any help on this would be appreciated! 🙂 

Link to comment
Share on other sites

While it is possible to solve it within template using a lot of PHP and heavy customizing, I would not do it.

The best way would be a custom widget, based on Similar Content widget. This widget pulls all the items containing the same tag(s). You would create your own, add some filters, like categories and sorting (e. g. by popular).

The widget I refer to is applications/core/widgets/relatedContent.php

Link to comment
Share on other sites

  • 2 weeks later...

I've made some progress on this, trying to figure out the labyrinth that is IPB's Pages/Items/Records parameters and how they can work (it'd be nice if Invision Community Staff maybe produced a full Handbook that outlined every relevant node's parameters and how to call them... including how to code simple things like IF statements based on whether a Yes/No custom field has been set - something I somehow figured out on my own 😄).

I've hit a bit of a brick wall though in fine-tuning it. The new topic is here - would appreciate anyone's input!

 

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...