Our Blog > Blog Detail

Web Content Viewer- Asponte Custom Skin


InContext Primer: What is InContext?

  • Created By: Kapish Aggarwal
  • Updated: February 23, 2016

The InContext tag is a powerful tool in the WCM Developer's arsenal that can be useful and tricky to utilize properly. It was briefly touched upon in a prior blog post about Context Switching tools that WCM provides. The InContext tag allows the developer to temporarily change the backdrop of the presentation code to a different item. What does the "In Context" tag look like?


The above is a simple example of the InContext tag in use, but it is a wrapper around standard presentation code.  The above code would set the backdrop of the code to whatever content or sitearea satisfies the "autofill" context, whereas the below code would set the backdrop to the content that satisfies the "portletContext" context.


To see the InContext tag in action, we'll use the content setup detailed below. The only authoring template used in this example is a custom defined template called "Building". It doesn't contain any extra fields and is used solely for the purposes of this primer. Authoring templates are specified using parenthesis, all other lines represent site areas.

WCM Library
    1900 Building
      1900 Building (Building)
    1800 Building
      1800 Building (Building)
    1700 Building
      1700 Building (Building)

We'll use a simple Menu Component to show InContext working on a simple level. Create a Menu component that filters using the authoring template "Building". Use the following code in the "Result design:" presentation markup.

Using the preview option, run the Menu against another piece of content. I used the built in Sample Article content located in the Web Content library. The output should look similar to:

Outside InContext Tag Result 1

Title Current: Sample Article

Title Autofill: 1700 Building

Inside Autofill InContext Tag Result

Title Current: 1700 Building

Title Autofill: 1700 Building


Note how the "current" context during the result design section is the piece of content (or site area) that the menu is running against. As expected the "autofill" context returned the result from the Menu's filter. Within the InContext tag, however, note the result of the Property tags that use the "current" context. They no longer reference the Sample Article, but reference the Menu result. That is because the context was switched to "autofill", which changed the context of the presentation code to the "1700 Building" content. This means the tag referring to context of "current" will now reference the "1700 Building" content instead of the "Sample Article".

In the next part, we'll discuss more details about how InContext works.

Referenced Links:

Asponte Labs Blog: WCM Context Switching Tools

IBM Knowledge Center on InContext tag http://www-01.ibm.com/support/knowledgecenter/SSHRKX_8.5.0/help/panel_help/wcm_dev_tag_incontext.dita?lang=en

Contact Form- Asponte Custom Skin


Contact Us


Call Us 888-926-9434
Complementary Content