CQWP PageQueryString and PageFieldValue
PageQueryString allows to configure the Content Query Webpart dynamically using the query string in the url. Let's configure the CQWP to retrieve different categories of announcements based on the query string value.Add a CQWP to the page and configure Query section as follows :
Source: Show items from all sites in this site collection
List Type: Announcements
Content Type:Show items of this content type group : My Content Types
Content Type:
Show items of this content type: Company
Announcements
In additional filters Select "Announcement Category" filed is equal to [PageQueryString : Category]
Save
the webpart. I have placed the CQWP on the homepage of my site
"http://intranet.contoso.com", so if I change the url to
"http://intranet/SitePages/Home.aspx?Category=Technology", this is the
result I get.
PageFieldValue
is used to show the related content. Following examples illustrates it.
Go to your list which contains our custom content type
"Company Announcements". In the ribbon select List->Customize Form->Modify Form Webparts->Default Display Form
Add
CQWP and configure the webpart to use our custom content type. In
Additional filters section select Announcement Category is equal
to [PageFieldValue:Announcement Category] and Title is not equal
to [PageFieldValue:Title]
This
will ensure that when we click on an item we will also get to see
related items based on the Announcement Category of the current item and
at the same current item will not be shown in the related announcements section.
No comments:
Post a Comment