Item Publisher

The item publisher app lets you publish items on your website.

Using this app you can:

  • Select a type of item to publish
  • Control how the items are rendered in frontend
  • Set up filters, to further control which items to publish
  • Enable or disable frontend-editing of items

Before you can use the item publisher app you need to have one or more item types defined, and you need to have one or more items created. 

To use the Item Publisher, add the app to a paragraph on a page - you will then have access to the app settings window.

From here, you can control the behavior of this instance of the app - or remove it altogether.

 

Figure 2.1 The app settings window

The data settings control which items and item fields you publish.

Figure 3.1 The Item Publisher data settings

Here you can:

  • Select the item type you want to publish
  • Select the area you want to publish items from. Your options are:
    • Select items from this language/area – publish items from a specific website
    • Select items from current language/area – publish items from the website with the app attached
    • Select items under the current page – publish all items under current page (the page with the app attached)
    • Select items under the following pages – publish items from one or more pages.
    • Select specific item(s) – publish specific items from the item repository.
    • Named item list – publish items from a named item list
  • Include paragraph items – also publish the paragraph items belonging to the pages you publish
  • Include child items – publish all items (children, grandchildren, and so on) under the selected page/website.
  • Include inherited items – publish all items inherited from a base item type. Available from 8.6.1.0
  • Show login for restricted items – list restricted pages, but require login for accessing the details
  • Item fields – lists: Specify which item fields you want to show in the list view when publishing items
  • Item fields – details: Specify which item fields you want to show in the details view when publishing items

By default, the item publisher will only publish items which are one level below the page with the item publisher app on. Check the include all child items to publish items from futher down the content tree.

Page content from the page with the app attached is excluded - but item based paragraphs can be published by checking the include paragraph items checkbox.

The list settings (Figure 4.1) control how you display the list view of the items you publish.

Figure 4.1 The Item Publisher list settings

Here you can:

  • Select the template you want to use for the list view
  • Specify a sort order
  • Select you list view type
    • Normal provides you with ordinary paging. Write the number of items you want on a page in the Page Size field.
    • Partial provides you with the option of selecting a partial list of items to show – enter the item to start from in the item from and the item to end with in item to field
  • Specify a page size in items

The details settings (Figure 5.1) control how you render the details view of the items you publish. 

Figure 5.1 The Item Publisher details settings

With the details settings, you can:

  • Select the template you want to use for the details view
  • Specify the paragraph you want to display the details view on, when a user clicks view or edit on an item – the selected paragraph needs to also have the item publisher app attached, with the same item type selected.

When to use the details template

In most cases, if you're publishing page items you don't need to use the details template at all. Just use the list template to render the full page - or link directly to the page instead.

With filtering settings, you can set up conditions (rules) in order to limit the subset of items published.

Figure 6.1 You can filter the items before publication by creating filtering rules

To set up a rule:

  • Click add new rule
  • Choose a field to filter on
  • Add a condition and a value to test for
    • Conditions available: is/is not, contains/does not contain, starts with/does not start with, and ends with/does not end with
    • You may choose between the operators AND and OR when combining your filtering rules.

WIth the edit settings you can enable frontend editing of item fields published, and with the error messages settings you can customize the errors shown when users try to save empty or invalid field entries.

Figure 7.1 Enable frontend editing of item fields by using these settings

With the edit settings you can:

  • Enable editing of item fields in the frontend
  • Select the template you want to use for the edit page

With the error messages settings you can:

  • Specify the error message on an incorrect field value used
  • Specify the error message on an empty field

Read about item types and field types to learn how to make an item field required, and how to introduce validation on an item field.

The Item Publisher supports query string filtering.

System type string fields can be filtered using the following operators: 

Example Filtering effect
Name=Razor Exact match
Name=t* Starts with
Name=*t* Contains
Name=*t Ends with

 

System type numeric fields can be filtered using the following operators:

Example Filtering effect
Number=10 equals
Number=10&Number.op== equals (operator specified)
Number=10&Number.op==eq equals (operator specified)
Number=10&Number.op=!= not equal to
Number=10&Number.op=<>  not equal to
Number=10&Number.op=< less than
Number=10&Number.op=<= less than or equal to
Number=10&Number.op=> greater than
Number=10&Number.op=>= greater than or equal to
Number.from=10&Number.to=20 range (explicit)
Number=10-20 range (implicit)
 

 

System type double fields can be filtered using the following operators:

Example Filtering effect
Double=0&Double.op=lt less than
Double=0&Double.op=gt greater than

 

System type date fields can be filtered using the following operators:

Example Filtering effect
DateAndTime=2014-08-01 equal
DateAndTime=2014-08-01&DateAndTime.op=<  before
DateAndTime=2014-08-01&DateAndTime.op=lt  before
DateAndTime=2014-08-01&DateAndTime.op=> after
DateAndTime=2014-08-01&DateAndTime.op=gt after
 

 

Other useful parameters are:

Parameter Effect
PageSize Forces a pagesize. Overrides the page size defined in the item publisher settings.
orderby=[field] Selects a field to sort by
orderby2=[field] Select an additional field to sort by
direction=[ASC/DESC] Selects a sort direction
direction2=[ASC/DESC] Selects an additional sort direction

The Item publisher extension tags - Item.Render/RenderItem() & Item.RenderList/RenderItemList() - are methods to render an item directly in a template without the use of a page or paragraph.

For example:

Example 1: string DataFromItem = RenderItemList(new { ItemType = "NameOfMyItem", ListSourceType = SelfPage, ListSourcePage = "3223", ItemFieldsList = "*", ListTemplate = "ItemPublisher/ListMyItems.cshtml", ListPageSize = "100", }); @DataFromItem Example 2 - Multiple SourcePages string DataFromItem = RenderItemList(new { ItemType = "NameOfMyItem", ListSourceType = SelfPage, ListSourcePage = "3223, 1432, 3421", ItemFieldsList = "*", ListTemplate = "ItemPublisher/ListMyItems.cshtml", ListPageSize = "100", }); @DataFromItem Example 3 - Using a filter @{ var areaId = GetInteger("…"); if (areaId > 0) { @RenderItemList(new { ItemType = "Contact", ListSourceType = "SelfArea", ItemFieldsList = "*", ListTemplate = "ItemPublisher/List/List.cshtml", ListPageSize = 10, ListOrderBy = "Name", Filter = "Areas contains \""+areaId+"\"" }); } }

The following parameters are available to you when using the tags:

 

Property

Description

Type

Condition

Default

Possible values

ItemType

A specific item type that you use for pages. The item fields from the selected item type is published in frontend.

string

Mandatory

 

Item type system name

ListSourceType

Source to render item publisher list

string

Optional

ItemEntry

Area,
Page,
SelfPage,
ItemEntry,
ItemEntries

ListSourceArea

ID of a specific website to take data from all published content based on the ItemType

string

Mandatory if ListSourceType=Area

 

ListSourceArea:10; 

ListSourcePage

ID of one or multiple pages divided by semicolon to take data from the published content based on the ItemType under this/these pages 

CSV string of page ID’s

Mandatory if ListSourceType=Page

 

ListSourcePage:313,298;

SourceItemEntries

ID of one or multiple specific item type used for content. 

CSV string of tem ID’s

Mandatory if ListSourceType=ItemEntries

 

SourceItemEntries:3,9;

ItemFieldsList

Defines field set to render

CSV string 

Mandatory if ListSourceType is Area, Page, SelfPage or ItemEntries

 

ItemFieldsList:Fld1,Fld2;
ItemFieldsList:*; to take all fiels

ListTemplate

Defines template to render frontend 

string

Mandatory if ItemFieldsList is used

 

ListTemplate:ItemPublisher/List/List.html;

ListOrderBy

Allows to order by a specific field via its system name. You can also use Sort value which is the order that the pages are sorted in the menu tree or Created/Updated value to order the list by date creation/updating 

string

Optional

Created

ListOrderBy:FldName;
ListOrderBy:Sort;
ListOrderBy:Created;
ListOrderBy:Updated;

ListOrderByDirection

Defines that order should be Ascending or Descending

string

Optional

Ascending 

Ascending, Descending

ListViewMode

Defines ordinary paging or a partial list of items

string

Optional

Normal

Normal, Partial

ListShowFrom

Defines ‘from’ item in the partial list

number

Mandatory if ListViewMode=Partial

1

ListShowFrom:1;

ListShowTo

Defines ‘to’ item in the partial list

number

Mandatory if ListViewMode=Partial

End item

ListShowTo:6;

ListPageSize

Defines list paging, parameter value is item quantity on page

number

Mandatory if ListSourceType is enabled

All items

ListPageSize:10;

IncludeParagraphItems

This will publish items of the defined type that are paragraphs as well as pages.

boolean

Optional

False

IncludeParagraphItems:True;

IncludeAllChildItems

This will return all pages (children, grandchildren and so on) under the defined source

Optional

 

False

IncludeAllChildItems:False;

ShowSecurityItems

Allows to show items gathered within content under security 

boolean

Optional

False

ShowSecurityItems:True;

SourceItemEntry

Defines to render data from specific item (ID) used within a content

number

Mandatory if ListSourceType is ItemEntry(not specified)

 

SourceItemEntry:9;

ItemFields

Allows to specify item field set 

CSV string

Mandatory with SourceItemEntry

 

ItemFields:FieldName1. FieldName2;
ItemFields:*;

DetailsTemplate

Defines template to render te itementry

string

Mandatory with SourceItemEntry 

 

DetailsTemplate:ItemPublisher/Details/Details.html;

Filter Default filtering value string Optional   All filtering values, see Query String Filtering section 

Database

There is no database specific information for this subject.