Projection

This topic targets, and was tested with, the Orchard 1.8 release.

The Orchard.Projections Module Provides methods to control how lists of content items are filtered and displayed.

Dependencies : Orchard.Tokens, Orchard.Forms, Feeds, Title

In this particular demo, we'll create an External Post functionality using Query , Projection Page and Projection Widget.

Creating External Post Content Type

Learn how to Create Custom Content Types

1.External Post Content Type

2.Adding 3 Fields Title, Author, Url and 1 Part BodyPart

3.Click on Edit Placement to place fields and parts accordingly

4.Creating External Post

Creating a Query

1.Creating a Query "ExternalPostQuery"

Editing a Query : Filter, Sort, Layouts

2.Click Add a new Filter

Select External Post as the Content Type

3.Click Add a new Sort Criteria and Select Publication Date

4.Click Add a new Layout and Select Html List

5.Save the Layout with Display Type as Detail

5.Previewing the query result

Adding Properties to the Html List Layout

Change Display Mode to Properties

1.Title Property

Open Rewrite Results -> Select Rewrite output

Rewriting the output for the Title Property and using Tokens to the Title and Url fields.

<h1><a href="{Content.Fields.ExternalPost.Url}" target="_blank">{Content.Fields.ExternalPost.Title}</a></h1>

2.Author Property

Rewriting the output for the Author Property and using Tokens

<p>Posted By <b>{Content.Fields.ExternalPost.Author}</b> on {Content.Date}</p>

Creating a Projection Page for ExernalPostQuery(Unordered Html List)

Select the Show Pager check box to add a pager to the list.

Rendering Results using Projection Widget

Select ExernalPostQuery(Unordered Html List) For Query

Rendered Result