Dynamic content pages in WebCenter Spaces

One of the flexible features of Site Studio is the concept of secondary pages. Secondary pages are pages which can dynamically display content within a specific template. Think of a list of products as the primary page...and the product page itself as the secondary page. Typically the secondary pages will have a similar structure. It's just the content itself that will change.

So I was trying to apply a similar concept to WebCenter Spaces. Since WebCenter 11g PS3 now supports both Site Studio data files and region templates within Content Presenter, it's very easy to add Site Studio content and display to a page. But in this case, I didn't want to hard-code my content and region template to the page. I wanted it to be variable, depending on what I passed.

Now if you have a data file that is being linked to in Spaces in the standard way, a URL is constructed that looks something like:

http://server/webcenter/faces/oracle/webcenter/sitestructure/render.jspx?datasource=WebCenterSpaces-ucm%23dDocName%3AUCM_025405

And when you go to that page, you'll get that content rendered in Content Presenter with the default template defined. Now with a custom Content Presenter template, you can put in logic to detect the Region Definition of your content and display that given a specific Region Template. But that would mean you would need to modify your custom template every time you had a different definition or template. And it means you only have the choice of one template per data file. The other drawback to this approach is the page you're taken to is completely out of context with the Space you were in. It takes you to your personal space to display the content there.

So because my goal is to control both the data file and region template for display, and control the page/context in which its displayed, I needed a different method. So I made use of page parameters and passed those values to the Content Presenter settings to define the content and template.

My first step was to create a "fallback" data file and region template to display in Content Presenter if the page parameters were not defined. This allows Content Presenter to display something...if nothing is defined. For the data file, I created a very simple Region Definition with one WYSIWYG element and a Content ID of 'RD_SINGLE_WYSIWYG'. Once I had the Region Definition, I went into UCM to Content Management -> Check In New Web Asset and created a new data file based on that Region Definition. I make note of the Content ID for that data file as it's used later on. I then created a Region Template for that definition in which I simply display the one element. That has the content ID of 'RT_SINGLE_WYSIWYG'.

rt_single_wysiwyg.png

Next, I create the page I want to use as the secondary page. After creating the page, it sends you into edit mode for that page. In the top left, click on Page Properties to bring up the properties dialog.


page_properties.png

Next I click on the Parameters tab and then click on the 'Add a page parameter'. I name the new parameter 'contentid'. I create another new parameter named 'regiontemplateid'. In the 'contentid' parameter, I add the code that will either pick up the value being passed or default to the Content ID of the data file I created earlier:

#{(param.contentid == null)? 'DEFAULT_DATA' : param.contentid}

Then in the 'regiontemplateid' field, I enter that code:

#{(param.regiontemplateid == null)? 'RT_TITLE_BODY' : param.regiontemplateid}

So now if parameters are not passed, these default values will be used.

edit_properties.png
Next I add the Content Presenter to the page through Composer. Now instead of clicking the Edit button which would launch the Content Presenter wizard to assign the content and template, I click on the Edit button to the right which edits the property of the task flow. This allows me to specifically enter the values for the content and template.

component_properties.png

For Data Source, I enter:

#{'WebCenterSpaces-ucm#dDocName:'}#{bindings.contentid}

This identifies the content to display. It pulls in the value from the page parameter established above. The 'WebCenterSpaces-ucm' portion will be specific to each implementation. It's the name of the Content Repository Connection that is established between WebCenter and UCM.

For Region Template, this is set to:

${true}

This identifies this template as being a Site Studio Region Template.

For Template View ID, I enter:

#{bindings.regiontemplateid}

This pulls in the value for the template from the page parameter.

Now the configuration is complete. So now if I want to display content on this page, I simply define a URL to the page and pass in the 'contentid' and 'regiontemplateid'. You can get the friendly URL for your page by going to Manage Pages and selecting the actions icon and About This Page.

http://server/webcenter/spaces/ravenna/page/ProductDetails?contentid=UCM_000123&regiontemplateid=RT_PRODUCT_DETAILS

Comments:

Hi Kyle, I'm trying to get this to display just a simple RT within Content Presenter. No data files, no extras. The RT would simply run a query against UCM and then display the results. I set the page parameter to default to an RT that has a simple 'hello world' idoc (for testing) but every time I set it up the page goes blank or nothing displays in the Presenter. Any tips/suggestions? Thanks for the great work here!

Posted by oMaT on May 17, 2011 at 04:17 AM CDT #

When I do this, and press "Ctrl+Shft+C" to get into contribution mode, nothing comes up on the page, as if it rejects the contentid and the regiontemplateid params in the url altogether. Can you please advice how to get around this issue?

Posted by guest on June 13, 2011 at 02:24 PM CDT #

So is the page working in regards to viewing the page with the content and going into edit mode? I'm not exactly sure what could cause the page to be unable to get into contribution mode. Perhaps there is something in the content itself that is interfering with contribution keystroke. I've seen this before when including jQuery scripting within the content. Can you try a very simple region template to test? Thanks, -Kyle

Posted by Kyle Hatlestad on June 14, 2011 at 06:56 AM CDT #

OMG, you are right.
I actually copied a big block of HTML from somewhere and just used it in a WYSIWYG, and it was not working. When I changed to a simple couple of lines of html, it works as expected.

Thanks a lot for the hint.

Posted by Ashish Tripathi on June 14, 2011 at 12:29 PM CDT #

Thanks Kyle, not exactly the same way, but I have tweak and it really works for me, I am using a list of nodes, and in secondary page the selected node displays more.

- Pranab

Posted by Pranab on August 23, 2011 at 06:55 AM CDT #

I used the method you describe in conjunction with a news list, and feed the content ID + template in URLs as part of a content presenter template.
When I click on a news item it displays the full details successfully.
When I press CRT + SHIT + C, it reverts back to the default data file rather than the news file I was viewing.

Also as a side node, when using a content query in navigation, if you wanted to use your own template for displaying the content we would need to find a way to customer navigaiton-render.jspx similarly to the method you described, however I don't think this is easily performed. I tried playing with template category, and setting the template as default but could never get the template I made to default for the nav, even when I 'hid' the default one.

Let me know if anyone was able to work this out. (my current work around is to show the news list as part of the nav, and it shows just the news title. From there authorized contributors can modify the news data files which in turn update the news list in the home space.

If anyone is interested I can write a guide on how to get the whole news functionality imported for any instance, you'd need a public business role page for the renderer, a content presenter ear, and a ucm archive. Although it's not too hard to build from the blogs posts available. The tricky part is getting the URL right in content presenter (weird escaping of characters is needed).

Posted by Guillaume on September 08, 2011 at 06:21 PM CDT #

Hey Guillaume,

Thanks for pointing out the issue of editing the content using the Ctrl+Shift+C keystroke. Probably the best way to edit and manage those content items is to allow editing of those items through the dynamic list and to edit the items from there.

As for defined templates through the content query in navigation, that I haven't tried. Nor can I think of a workaround for it. Perhaps someone else has tried.

Thanks, Kyle

Posted by Kyle Hatlestad on September 09, 2011 at 03:18 AM CDT #

An Alternative was to add an edit button on the news details RT and put some security around it:
<A HREF="http://owcvm03/cs/idcplg?IdcService=WCM_EDIT_DATA_FILE&dDocName=<!--$dDocName-->&cpIframe=false&forceLogin=1&ssUseSimpleLinking=true" target="_blank">Edit</a>
However, when I press Save and Close in SiteStudio it unfortunately reloads the editor page rather than close the tab. I couldn't find an option to modify this.

I might still try to the dynamic list idea, but I'm not sure on how it will change the content presenter news list template in terms of iterating nodes.

Posted by Guillaume on September 11, 2011 at 05:34 PM CDT #

I tried associating a content presenter to a dynamic list, but to assign the new web content (or single content using browse), it can't bind the two. I'm guessing presenter doesn't know yet how to handle static and dynamic lists, unless they are native to presenter (under a folder, result of query etc). So for now the editing isue still remains. I also tried playing with sessionScope to bind the contentid to a variable which the page would remember beyond the CTR SHIFT C action, but it didn't seem to alter the outcome. I really wondered how presenter initialised its parameters after that action and why it is losing it.

Posted by Guillaume on September 11, 2011 at 08:16 PM CDT #

Hey Guillaume,

Yes, that's why you should use a Region Template to display your dynamic list instead of a Content Presenter template. Then you can go into contribution mode with that list add add/edit/delete your content items that way.

Thanks,
-Kyle

Posted by Kyle Hatlestad on September 12, 2011 at 03:09 AM CDT #

Hey Kyle,

What steps would you take to display primary pages so that you can edit them in WC Spaces? The reason I ask is because the majority of our site's content is displayed in primary pages and we would like to try and incorporate them in WC Spaces.

Thanks,
-Stan

Posted by guest on September 21, 2011 at 01:01 AM CDT #

Hey Kyle,

I have everything working except displaying the page information. When I go into edit mode I can see all of my content just fine (links/text). The same is true for when I click on the preview button in edit mode. However, when I click Save & Close, the page will not show what I see in edit mode.

Any suggestions?

Posted by Stan on September 21, 2011 at 04:08 AM CDT #

Hey Stan,

So this is a Site Studio data file, correct? And you've found that you can include that content using Content Presenter? When you include that content, you should make sure you associate the correct Region Template to it. There is a quirky bug in which you don't get the list of region templates in Content Presenter when you create/assign the Site Studio web asset. You have to hit save and then edit it again. Then the Region Template should be in the list to pick from.

If this doesn't help, then I'd suggest opening a ticket with support to have them look at your configuration.

Thanks,
-Kyle

Posted by Kyle Hatlestad on September 21, 2011 at 05:27 AM CDT #

Hey Kyle,

Sorry for the 2x post. Anyhow, it turns out that the problem was we put the content presenter of the data file on the Space Home page. When we put it on a sub-space or sub-page, it worked perfectly, even with the same exact configurations.

Do Home spaces have different default configurations? Can you change them?

Thanks!
Stan

Posted by Stan on September 21, 2011 at 08:13 AM CDT #

Hey Stan,

I don't know why that would be. The Content Presenter taskflow should work anywhere it is placed including a spaces's Home page.

Thanks,
-Kyle

Posted by Kyle Hatlestad on September 22, 2011 at 11:24 AM CDT #

Hey Kyle,

Not sure why that doesn't work either. Do you know, perchance, if there is a setting to remove the button to "Create new web content in Site Studio" when you go into edit mode/CTRL+SHIFT+C?

Thanks,
Stan

Posted by Stan on September 27, 2011 at 03:09 AM CDT #

hello :
I have the same case for product and product details but ii need to implement it through Spaces ,the problem is i follow those steps but when try to add webcontent to the presenter and try to choose Region template for my dynamic list error appeard that content presenter cant save configuration file ,any idea please!!!

Posted by guest on October 25, 2011 at 04:57 AM CDT #

You may need to look at the server output from Spaces to get a more detailed error message to know what's wrong. Perhaps it's a syntax error? You also need to make sure you have a valid default Data File and Region Template to match it to make sure the page has something to fall back to when it originally gets created and before you have a chance to set it. In the above example, the Data File is a content item with the Content ID of 'DEFAULT_DATA'. This should have a Region Definition defined for it that matches the Region Definition for the Region Template of 'RT_TITLE_BODY'. This lets the page display something if nothing is passed as parameters. If the page is not able to display something with those, then you'll get a page error.

Thanks,
-Kyle

Posted by Kyle Hatlestad on October 28, 2011 at 04:08 AM CDT #

Hi,

I have the same problem as the first post, first page 'blank page' problem. Somebody knows any solution?

Thanks,
Joan

Posted by Joan on November 09, 2011 at 05:35 AM CST #

Hello:
I need to implment news like latest news using dynamic list and when click on any news ,i need to open in a new page with the full nes details ,i am using region templetes In webcenter Spaces ,i did try the approach above but the page open in empty ?!!! please any help.

Posted by Dima on November 20, 2011 at 08:11 PM CST #

I can see how one uses a HSCP region template with this functionality but the docs say you can use a SSXA region template as well. How do you reference the jspx template in the content presenter taskflow parameters. Do you need to check it into Site Studio?

Posted by guest on December 14, 2011 at 05:34 AM CST #

hello ,
i want to know if i can display content by using content presenter that created in site studio according to current space name ??

Posted by guest on September 30, 2012 at 07:46 AM CDT #

Hello,

We are successful in getting the secondary pages to work.
We are doing the webcenter spaces inline contribution in PS5.
When I hit shift+ Ctrl + c , it is taking me to the default page contribution mode instead of the actual secondary page.Can you please let us know how to make inline contribution process work with secondary pages.

Posted by guest on November 20, 2012 at 11:15 AM CST #

Hi Kyle,

Do you have a preference of Dynamic pages vs static pages in Webcenter?
We are using the above approach of passing parameters into webcenter - spaces navigation,instead of creating individual pages.Can you please let us know your opinion.

Posted by guest on December 19, 2012 at 08:47 AM CST #

Hi Kyle,

Is there a way to read the parameters that we set on the Page properties in Site studio.

Example,
If we consider the above one, can we read the value of the regiontemplateid that we set on the page properties.

Regards,
Harika

Posted by guest on February 19, 2013 at 12:42 PM CST #

Hi Kyle,

we went with an alternative option of Edit button to do the contribution.
But, we are not able to close that contribution window when we hit save and close.

Can you please let us know if there is a way to do that and how do we close the window.

Thank you!

Posted by guest on May 01, 2013 at 03:35 PM CDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Kyle Hatlestad is a Solution Architect in the WebCenter Architecture group (A-Team) who works with WebCenter Content and other products in the WebCenter & Fusion Middleware portfolios. The WebCenter A-Team blog can be found at: https://blogs.oracle.com/ ateam_webcenter/

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today