Dynamically changing component reference

606 views Asked by At

This seems simple enough but I can't quite think of how to actually do it...

In IBM Web Content Management (WCM) version 7 I have a Presentation Template (PT) which calls a Menu Component to display some content items.

I also have some (static) links on the sidebar which I want to basically just change the menu component that is being used, and that's it.

So for example...

In the PT:

[Component name="Main Page"]

When I click on a link, I want the exact same PT to be displayed except I want it to use:

[Component name="Next Page"]

Basically, Main Page and Next Page are showing the same content items, they just have different filters on them (so they appear to be different pages). The "Main Page" shows "everything" and then if you click on a link it's suppose to only show a subset of that.

I can't quite figure out how to connect the link to the PT to change it. I've thought about using JavaScript or JSP to simply rewrite the HTML, but even then I'm not sure how I set it up to say that: "if the link has been clicked, rewrite the HTML" because I'm not sure what to even point the link to, or pass through the link.

I thought about creating different content items with different PTs to link to, but there are about a dozen links (and therefore a dozen different Menu Components that I want to use), so I thought it might be better in the long run to just use 1 dynamic PT (in case the number of links grows).

It is only that one component that needs to be changed in order to display how I need for every link though.

Any ideas how to go about doing this?

1

There are 1 answers

1
ZeekLTK On BEST ANSWER

So this is how I resolved this:

I created a component reference element in the content items called "menuComp" and then I set that to point to the appropriate Menu Component for each particular page.

In the presentation template, I removed the component reference and changed it to an [Element] tag which used key="menuComp".