Smart Pages

From Sense/Net Wiki
Jump to: navigation, search
  • 80%
  • 6.0
  • Enterprise
  • Community
  • Planned


Smart Pages is a term we use to refer to Portlet Pages configured in a specific way to get the most benefit out of the Smart Application Model. This means a single page can be set up to serve an entire class of content items, through simple URLs pointing to the content itself. The most common Smart Applications used in Sense/Net are Smart Pages. (Other classes of Smart Applications include placeholders for HttpHandler classes, XSLT renderers, etc.)

Context Binding

Working with Context is paramount in creating Smart Pages. When you build a Smart Page, each of the components (Portlets) used must be configured to access the appropriate data relative of the context. This configuration is called Context Binding.

The concept of Context

In Sense/Net, Context is, simply put, the content item requested in the URL. It is what you see in the location bar of your browser.

In a broader sense, Context can mean all the content of interest relative to the requested content item. (Eg. The item itself, its parent, its children, its Workspace, the Site it was accessed through, etc.)

Context Bound Portlets

All Portlets in Sense/Net that deal with content in any way are prepared for context binding. (Some legacy and special use portlets may be exempt from this rule however.)

Overview of a Smart Page

The above image is a Smart Page from the WCMS Community demo. The Context path is /Root/Sites/Default_Site/NewsDemo/Internal/Africa_is_calling.

As you can see, there are three main areas (Portlets) on this page, each with its own Context Binding configuration. The main area, which shows the article itself, is bound to the Context directly. However, the menu must display the menu for the news area (an ancestor), and the info box uses a centrally placed text, picked with an absolute path.

Configuring a Context Bound Portlet

All Context Bound Portlets share the configuration dialog shown below.

Context Binding configuration

Bind Targets

To achieve the diverse bindings needed on a page such as the one above, Context Bound Portlets have a configuration option called the Bind Target. The Bind Target specifies an anchor relative to the Context to bind to.

For Math-headed people, it specifies the point of entry into the content graph.

The possible Bind Targets are:

  • CurrentContent - The Context node itself.
  • CurrentWorkspace - The closest ancestor Workspace of the Context.
  • CurrentSite - The Site used to access the system. (Depends solely upon the domain name used. See the documentation on Sites for detail.)
  • CurrentPage - The Smart Page itself. If you are using a Portlet Page as primary content, this is the same as CurrentContent.
  • CurrentUser - The content representation of the user who is logged in.
  • CustomRoot - Automatic Context Binding is disabled, and the Portlet is bound to a content item with an absolute path.

Depending on the version of Sense/Net used, there may be additional Bind Targets in the system. These serve legacy and compatibility purposes only, and should not be used.

Relative content selection

Once the origin of the Context Binding is established via the Bind Target, the Portlet can be fine-tuned to pick a specific content item relative to this origin.

This is done via a relative path, such as ../Img/myimage.png, or Img/myimage.png.

Depending on the version of Sense/Net used, instead of the .. moniker, the Ancestor selector index parameter may be used to access ancestors. An Ancestor selector index of 0 means the Bind Target itself.

Eg. a relative path of ../../../Img/myimage.png can be translated as an Ancestor selector index of 3, and a Relative content selector path of Img/myimage.png.

Custom root

By setting the Bind Target to CustomRoot, and picking a content item in the Custom root path parameter, the Portlet will always use the picked item, regardless of the Context.

{{Info|Picking a content item as the custom root will automatically change the Bind Target to CustomRoot.)

Related pages