Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
how to make a component display differently depending on what page it is located on
rohit34582
Hi,
I've a component that displays differently on different pages depending upon what link (to a livesite page) has been selected within that same component...
One way I'm accomplishing this is by using different skins and using the appropriate skin on the appropriate page...but there are too many pages and Im looking for a generic solution that will let the component know what page it is on and render appropriately...
All the content is comming from the default.sitemap....
Thanks...
Find more posts tagged with
Comments
tec_iwov
there is currently no way to dynamically change the skin during runtime.
one way would be to have one skin and pass a value in the xml that would then be used to tell it what xsl template to use
rohit34582
But how do i get to know what page my component is located on?....
Eventually to be able to capture what presentation tags to be used depends upon which page my component is placed on...
AlexC
Your component's external has access to this information (3.0+). Things like getPage() and getFileDAL() provide objects that contains this information, based on that you add an element to your result XML document that lets XSL know to use a different xsl template(s). This is how login component works, if Result/IsLoggedIn exists it displays logout component otherwise the login is displayed, all within a single XSL stylesheet.
tec_iwov
there is a getPageName() off the request context that your external has access to.
rohit34582
ohh...ok...thanks people...
Just to clarify then...I need to use my own external then that would add this extra element...the out of the box site-map external class would not help me?
Just checking to see whether Im thinking right...
Stokes
Sounds backwards, since the component is supposed to be reusable across pages, but...
To do it
without
external code, could you use the page token $PAGE_LINK[.] to resolve to a
link
to the current page, and then determine what you need to from that in XSL?
I thought there was a $PAGE_NAME or something too in 3.0, but I don't see it in any of the docs I have handy.
AlexC
$CONTEXT{pageName} or $CONTEXT{page.name} I forget. Use $CONTEXT{*} and $CONTEXT{page.*} to see what is available, it's in the context
tec_iwov
i think those are only available in 3.1
AlexC
Yes, most of the answers are for 3.1, the OP did not specify a version. Pre 3.1 you can pretty much make it not appear but a component really do this and maintain a semblance of WYSYWIG.