Skip to content

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

  • 本主题针对Orchard 1.8版本进行了测试,并进行了测试。*

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

Orchard.Projections模块提供控制如何过滤和显示内容项列表的方法。

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

  • 依赖关系:Orchard.Tokens,Orchard.Forms,Feeds,Title *

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

在这个特定的演示中,我们将使用 Query,Projection Page和Projection Widget 创建 External Post 功能。

Creating External Post Content Type

创建外部帖子内容类型

Learn how to Create Custom Content Types

  • 了解如何[创建自定义内容类型](/ Documentation / Creating-custom-content-types)*

1.External Post Content Type

1。外部邮寄 内容类型

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

2。添加3个字段标题,作者,网址 1个部分BodyPart

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

3.单击编辑放置以相应地放置字段和部分

4.Creating External Post

4.创造外部岗位

Creating a Query

创建查询

1.Creating a Query "ExternalPostQuery"

1.创建查询“ExternalPostQuery”

Editing a Query : Filter, Sort, Layouts

编辑查询:过滤,排序,布局

2.Click Add a new Filter

2.单击添加新过滤器

Select External Post as the Content Type

选择外部帖子作为内容类型

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

3.单击添加新的排序标准并选择发布日期

4.Click Add a new Layout and Select Html List

4.单击添加新布局并选择 Html列表

5.Save the Layout with Display Type as Detail

5.将显示类型的布局保存为详细信息

5.Previewing the query result

5.预览查询结果

Adding Properties to the Html List Layout

将属性添加到Html列表布局

Change Display Mode to Properties

显示模式更改为属性

1.Title Property

1。标题属性

Open Rewrite Results -> Select Rewrite output

打开重写结果 - >选择重写输出

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

重写Title属性的输出,并使用 Tokens 到Title和Url字段。

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

{Content.Fields.ExternalPost.Title}

2.Author Property

2。作者财产

Rewriting the output for the Author Property and using Tokens

重写Author属性的输出并使用 Tokens

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

在{Content.Date}上发布 {Content.Fields.ExternalPost.Author}

Creating a Projection Page for ExernalPostQuery(Unordered Html List)

为ExernalPostQuery创建一个Projection页面(无序的Html列表)

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

选中 Show Pager 复选框以将寻呼机添加到列表中。

Rendering Results using Projection Widget

使用Projection Widget渲染结果

Select ExernalPostQuery(Unordered Html List) For Query

选择 ExernalPostQuery(无序Html列表)查询

Rendered Result

渲染结果