I have tried the following code in a DWT and the internal link (tridion:href= "@@Links0.Fields.link@@")
does not get resolved.
<a onclick="_gaq.push(['_trackEvent', '@@Links0.Metadata.ga_category@@',
'@@Links0.Metadata.ga_action@@', '@@RenderComponentPresentation
(Links0.ID,RemoveSpecialCharactersFromTitle)@@']);"
tridion:href="@@Links0.Fields.link@@" target="_blank" class="button primary" >
When I place this internal link attribute(tridion:href="@@Links0.Fields.link@@") before the onclick, the link get resolved successfully. But page fails at the time of deployment with the following error:
Closing Tag tcdl:ComponentPresentation does not match tcdl:Link Stack: TAG: (0) Param=false Mode=0 Class=com.tridion.tcdl.tags.DefaultTagHandler TAG:ComponentPresentation (0) Param=false Mode=0 Class=com.tridion.tcdl.tags.ComponentPresentationTagHandler TAG:Link (0) Param=false Mode=0 Class=com.tridion.tcdl.tags.LinkTagHandler ------ , Unbalanced tags in TCDL file Closing Tag tcdl:ComponentPresentation does not match tcdl:Link Stack: TAG: (0) Param=false Mode=0 Class=com.tridion.tcdl.tags.DefaultTagHandler TAG:ComponentPresentation (0) Param=false Mode=0 Class=com.tridion.tcdl.tags.ComponentPresentationTagHandler TAG:Link (0) Param=false Mode=0 Class=com.tridion.tcdl.tags.LinkTagHandler
So I found that there is some issue with @@RenderComponentPresentation(Links0.ID,RemoveSpecialCharactersFromTitle)@@
passed as the parameter in Google Analytics.
There are some project limitations, so we are rendering the Component Presentation inside the Google Analytics in the way mentioned above.
When I place the text returned by this Component Presentation, for example, "This is a sample product" it works correctly.
By this I mean the following internal link get resolved successfully:
<a onclick="_gaq.push(['_trackEvent', '@@Links0.Metadata.ga_category@@',
'@@Links0.Metadata.ga_action@@', 'This is sample product']);"
tridion:href="@@Links0.Fields.link@@" target="_blank" class="button primary" >
I tried to set the output of this Component Presentation in the RenderContextVariable
@@SetRenderContextVariable("linkTitle_withoutSC",
RenderComponentPresentation(Links0.ID,RemoveSpecialCharactersFromTitle))@@
And also tried the following way:
<a onclick="_gaq.push(['_trackEvent', '@@Links0.Metadata.ga_category@@',
'@@Links0.Metadata.ga_action@@', '@@RenderContextVariable.linkTitle_withoutSC@@']);"
tridion:href="@@Links0.Fields.link@@" target="_blank" class="button primary" >
But this workaround is not working since we can not set and use RenderContextVariable in the same DWT. Please let me know if I am wrong here.
Now I have been unable to find any other way to deal with the internal link in my situation.
Could somebody help me on this?
EDIT-2 SOME MORE INFORMATION ABOUT THE REQUIREMENT
Point 1- Reason to use @@RenderComponentPresentation(Links0.ID,RemoveSpecialCharactersFromTitle)@@
inside the Google Analytics
Component for this presentation is nested linked component so I can perform my task though a C# TBB or fragment having logic same to RemoveSpecialCharactersFromTitle
so I use RenderComponentPresentation
here.
Point 2- I am trying to set and use RenderContextVariable
in the same DWT of a CT so that it return me the string output[Title] .By this way I can avoid the conflict of tcdl:ComponentPresentation
and tcdl:Link
tags during the deployment phase.