Content collection Portlet
- 100%
- 6.0
- Enterprise
- Community
Planned
Overview
Sense/Net ECMS is all about content. Creating, modifying and displaying content is essential part of this system and displaying multiple content is the most commonly used feature of Sense/Net. Content collection Portlet is one of the three main portlets aiding this task (the other ones are the Content List Portlet that can be used to display items or files that reside in a content list and the Content query presenter Portlet that is built on a simple Content Query).
Details
Content collection Portlet is able to display multiple content on portal pages. The most common examples are news or article lists, latest memos, simple menus or top rated products. The displayed content can be children of a folder or Smart Folder and can be filtered with Content Query and sorted. Top and Skip also can be set. For all available settings check the Properties section.
Context binding
Content collection Portlet is a context bound portlet. This means you can (and have to) define a context to work with. This is by default the current folder or other container that the user is browsing but you can select any other container in the Sense/Net Content Repository.
Content to display
By default the Content collection Portlet displays the children of the current context. Direct children are shown if the All children property is unchecked, otherwise every content in the content repository below the current context will be displayed. You can provide a Content Query as filter (for example only content of type Article and the ones that were created this week). SystemFolder contexts are special cases in the sense that content under SystemFolders will never be displayed unless the Enabled autofilters is switched off.
Paging
If you want to enable paging you have to set the following two portlet properties:
- Enable paging
- Show pager control
For a brief description of ASCX views see the section below about collection views.
For more information about paging see the paging section in the article Collection View
Caching
Be aware that caching is switched ON by default on content collection portlets. If you want changes to take effect immediately (after adding new items for example) please switch caching off.
Properties
Own properties
| Property | Property name for embedding | Possible values | Description |
|---|---|---|---|
| All children | AllChildren | Leave unchecked if you want to get only direct children of content. Check it if you want to get all children of content. | |
| Children filter | QueryFilter | Optional filter for the children query | |
| Collection source | CollectionAxis | The source for the listed collection. 'Children' lists child contents of target, 'ReferenceProperty' lists referenced contents using given Reference property, 'VersionHistory' lists target's versions and 'External' uses ids from url parameters as source. | |
| Custom portlet URL key | CustomPortletKey | Give a custom key to refer to this portlet from the URL. | |
| Enable autofilters | EnableAutofilters | Enabled, Disabled, Default | If autofilters are enabled, system contents are not shown in the result |
| Enable lifespan filter | EnableLifespanFilter | Enabled, Disabled, Default | If lifespan filter is enabled, only contents with valid StartDate and EndDate will be in the result |
| Enable paging | PagingEnabled | Set it to false to list all contents on one page. Set it to true and use the 'Top' parameter to show only a given number of contents simultaneously | |
| Reference property name | ReferenceAxisName | The property name to use as the reference source | |
| Skip first | SkipFirst | The first given number of contents are skipped | |
| Sort by | SortBy | Sort field name | |
| Sort descending | SortDescending | Sort results by sort field ascending or descending | |
| Show pager control | ShowPagerControl | Set to true to show default pager controls at the top and the bottom of results | |
| Top | Top | The first given number of content are listed | |
| Uri parameter name | UriParameterName | The Uri parameter name to use as external source | |
| Visible fields | VisibleFields | A comma separated list of fields presented in the list |
Inherited properties
User interface
| Property | Property name for embedding | Possible values | Description |
|---|---|---|---|
| Portlet title | Title | text | Sets the visible title of the current portlet. Title header visibility is controlled with the Appearance property |
| Appearance | ChromeType | Default None TitleAndBorder TitleOnly BorderOnly |
Controls title and border visibility. By default both are visible |
| View | Renderer | Repository path | A custom view to render te portlet. Can be an ASCX file or an XSLT. |
| Custom CSS class(es) | SkinPreFix | text | When set portlet container div gets an extra css class. Ie. 'skinexample' adds css class 'skinexampleSkin' to container div |
Context binding
| Property | Property name for embedding | Possible values | Description |
|---|---|---|---|
| Bind Target | BindTarget | Unselected CurrentContent CurrentSite CurrentPage CurrentUser CurrentStartPage CustomRoot CurrentWorkspace Breadcrumb CurrentList |
Select the bound content. Set it to CustomRoot to select a content with absolute path regardless of the context |
| Custom root path | CustomRootPath | Root relative Repository path | Define bound content with absolute path when Bind Target is set to CustomRoot |
| Ancestor selector index | AncestorIndex | positive whole number | Set the bound content to the ancestor of Bind Target specified by index. 0 leaves the bound content as specified above, 1 selects parent, higher value selects higher order ancestor |
| Relative content selector path | RelativeContentPath | relative Repository path | Sets the bound content relative to the above settings with a relative path. Ie.: 'CustomChildFolder/CustomNode' selects 'CustomNode' from Bind Target's 'CustomChildFolder' child folder. Relative to ancestor when Ancestor selector index is set |
| Reference field name | ReferenceFieldName | text | Selects a referenced content of the bound content. Ie.: 'Manager' selects the Manager if the Bind Target above is the current workspace. |
Cache
| Property | Property name for embedding | Possible values | Description |
|---|---|---|---|
| Portlet is cached | Cacheable | true/false | If set the output of the portlet will be cached |
| Portlet is cached for... | CacheableFor | VisitorsOnly Everyone |
In case of 'Everyone' the output of the portlet will be cached for logged in users as well. |
| Portlet context influences caching | CacheByContext | true/false | Defines whether the current context path is included in the cache key. When unchecked portlet output is preserved regardless of the page's current context content or request path. Check it if you want to cache portlet output depending on the requested context content. |
| Request path influences caching | CacheByPath | true/false | Defines whether the requested content path is included in the cache key. When unchecked portlet output is preserved regardless of the page's current context content or request path. Check it if you want to cache portlet output depending on the requested context content. |
| Url query params influence caching | CacheByParams | true/false | Defines whether the url query params are also included in the cache key. When unchecked portlet output is preserved regardless of changing url params |
| Language influences caching | CacheByLanguage | true/false | Defines whether the language code is also included in the cache key. When unchecked portlet output is preserved regardless of the language that the users use to browse the site. If set, a different output will be cached for any language the users visit the site on. |
| Sliding expiration | SlidingExpirationMinutes | positive whole number | Given in seconds. The portlet is refreshed when it has not been accessed for the given time period |
| Absolute expiration | AbsoluteExpiration | positive whole number | Given in seconds. The portlet will be refreshed periodically with the given time period |
| Custom cache key | CustomCacheKey | text | Defines a custom cache key independent of requested path and query params. Useful when the same static output is rendered at various pages. |
| Debug | Debug | true/false | Check this property to show debug info about portlet cache state at the bottom of the portlet's layout |
for Portal builders
The easiest way to use the Content collection Portlet is to place it onto a portlet page. For more details check the following article:
Content collection views
Collecting the list of content is only the first part. To display the items you need to create a collection view. Sense/Net ECM system provides default collection views that you can use as a starting point.
- /Root/Global/renderers/ContentCollectionView.ascx
- /Root/Global/renderers/ContentCollectionView.xslt
XSLT views
Collection XSLT views are built upon an XML that the Content collection Portlet provides. You do not have to do anything about the xml; the portlet automatically provides it if you choose an XSLT view on the portlet properties window.
The XML provided by the portlet contains all the fields and actions of the listed content by default. You can fine-tune this by setting the Fields, Field list or Actions properties of the portlet to improve performance.
For more information about XSLT rendering check this article.
ASCX views
Ascx views are common ASP.NET user controls inheriting the ContentCollectionView class. They have access to the list of content provided by the portlet and have full control above the rendered html.
<%foreach (var content in this.Model.Items) { %> <div class="sn-content sn-contentlist-item"> <h1 class="sn-content-title"> <%=Actions.BrowseAction(content)%> <%if (Security.IsInRole("SmartEditors"))%> <%= Actions.ActionMenu(content.Path, "[SN]", "ListItem") %> </h1> </div> <%} %>
Paging can be implemented by a code snippet inserted above or below the displayed content:
<%foreach (var pageAction in this.Model.Pager.PagerActions) { if (pageAction.CurrentlyActive) { %> <span class="sn-pager-item sn-pager-active"><%=pageAction.PageNumber%></span> <%} else { %> <a class="sn-pager-item" href="<%=pageAction.Url %>"><%=pageAction.PageNumber%></a> <%} %> <% } %>
For more information about collection views check this article.
Page template and control embedding
Use the following markup if you want to embed the portlet into your Page Template or custom control. The attributes/options are the same as seen in the Properties section above (don't forget to include a unique ID and the runat="server" attributes).
<snpe:ContentCollectionPortlet Title="Main Menu" ChromeType="BorderOnly" BindTarget="CurrentWorkspace" Renderer="/Root/Global/renderers/MenuCollectionView.ascx" SortBy="Index" ID="MainMenu" runat="server" />
for Developers
Content collection Portlet defines behaviors and features that can be re-used in your own custom portlet that is related to displaying multiple content. For more information about developing a custom content collection portlet check the following article:
Example/tutorials
Related links
- Collection View
- XSLT Renderer
- Content List Portlet
- Content query presenter Portlet
- Content viewer Portlet
- List of Portlets
- Portlet
- Smart Pages
- How to display a Content Collection on a page
- How to develop a custom content collection portlet
- Smart Folder
References
There are no external references for this article.