How do I post a single item to multiple sections and merge section listings into one sorted list?

3 posts by 3 authors in: Forums > CMS Builder
Last Post: December 16, 2009   (RSS)

I'd like to:

- Post a single item in a section and have it appear in a list for multiple sections

- Merge lists from multiple sections into a single, sorted list


For instance, I'd like to be able to publish a news pieces in multiple sections, then merge the news pieces from those multiple sections into a single list on the home page of a website (as sort of an über feed).

Also, any way to do this and automatically generate an xml feed?

If you have plugins for CMS Builder or related posts in this forum that you're aware of please feel free to reference those as well.

Thanks in advance,

Aaron

Re: [zakcoop] How do I post a single item to multiple sections and merge section listings into one sorted list?

By Chris - December 16, 2009

Hi Aaron,

The easiest way to set something like this up is to use two multi-record sections: articles and categories. Create a list field in the articles section called "categories" and set it to be multi-value. You can then select which category or categories you want an article to belong to. Your home page can be a simple article list page, while your category pages will need to filter articles that belong to that category. To do this, you can add a "where" clause to the code that gets the articles, for example:

$thisCategory = "vegetables";
list($articlesRecords, $articlesMetaData) = getRecords(array(
'tableName' => 'articles',
'where' => "categories LIKE '%\t" . mysql_escape($thisCategory) . "\t%'",
));


I hope this helps! Please let me know if you have any questions.
All the best,
Chris