This project is read-only.

Widget to show extended info about last items of custom content type

Topics: Customizing Orchard
Jun 6, 2014 at 7:01 AM
Hi there!

Please help me to find right way to resolve problem.
I create custom contetn type "NewsItem" from CMS admin menu. There are fields "NewsDate" and "NewsCategory". I need to create widget on main page which will show last 4 news ordered by "NewsDate" descending. Also I need to show count of news with the same category as showing item. I can not make it with Query and Projection.
Orchard 1.6

How I cat to get needed content items in code by content type name?
Jun 6, 2014 at 8:34 AM
This is a perfect example for using projections, why can't you make use of that?
Jun 6, 2014 at 11:26 AM
Let me to describe task more detail.
I have a set of content items. Each item have category.
On the homepage I need to show last 4 news.
For each news in this list I need to show count of other news with same category.

For example, last 4 news have category:
1) meeting
2) celebrations
3) ecology
4) interview

For each I need to show link with text "And other N news in this category", where N - count of news with same category as news item.
How I can calculate count of other news with projection?
Jun 11, 2014 at 8:41 AM
I don't think that count is available in the projections. My guess is you need to implement a custom module.