2

I have been trying to output the XPM page tags from a C# TBB but for some reason the Dreamweaver Engine does not allow me to output HTML Comments.

Example:

I have the following HTML Comment code being pushed to the package as type HTML with Name = SiteEditTags:

<!-- Page Settings: {"PageID":"tcm:11-349-64","PageModified":"2013-07-24T09:58:04","PageTemplateID":"tcm:11-78-128","PageTemplateModified":"2013-08-06T18:11:34"} -->
<!-- Bootstrap script commented out for preview: <script type="text/javascript" language="javascript" defer="defer" src="http://tridion2011/Views/Bootstrap/Bootstrap.aspx?mode=js" id="tridion.siteedit"></script>-->

I can see it in the package as well but in the DWT @@SiteEditTags@@ gets replaced with nothing, which would indicate the Dreamweaver Template Engine is stripping out the HTML comments.

Could someone please help me identify if this is an inbuilt mechanism or a defect?

Thanks!

4 Answers 4

4

Why are you not using, or extending the standard Enable inline editing for Page TBB? If its just a case of not having the markup in Preview, you could easily do a check for RenderMode!=RenderMode.PreviewDynamic before calling the standard TBB.

If its just a case of defining a specific place where the Experience Mananger markup should go, then you can use the placeholder <!-- SITE_EDIT_INIT -->. Check the documentation [Login required]

3
  • Will, could you elaborate more on "extending the standard Enable inline Editing for Page TBB" ?
    – Kunal
    Commented Aug 7, 2013 at 18:42
  • I already have a Before and an After TBB's that wraps the "Enable inline editing for Page", all I want to do is take the output from "Enable inline editing for Page" and place it at a certain location in the Page DWT instead of having it at the end of the page since we are using ASP.NET Master Pages and the Site Edit tags need to be generated in a specific "Placeholder" :)
    – Kunal
    Commented Aug 7, 2013 at 18:44
  • 1
    You can do that using the placeholder <!-- SITE_EDIT_INIT --> check the docs sdllivecontent.sdl.com/LiveContent/web/… (requires login)
    – Will Price
    Commented Aug 7, 2013 at 19:38
3

I was thinking the Cleanup Template TBB (inside the Default Finish Actions TBB) removes all HTML comments as an intended cleanup action. But that is incorrect, so you are either outputting it with an incorrect type (HTML instead of Text or vice versa), or you cannot push HTML comments in the package (to be handled correctly that is, I think you need ContentType.HTML for the tags to render correctly but that might void your HTML comments).

Why not take a look at the Tridion UI 2012 functions for use in HTML templates, that uses Custom Functions rather than a TBB which pushes values into the package and that works fine.

2
  • Bart, thank you for pointing me towards the Tridion UI 2012 dreamweaver extension methods but the client seems to be reluctant in deploying "another DLL" to the GAC :(
    – Kunal
    Commented Aug 7, 2013 at 18:57
  • 1
    Shame, because that is what the GAC is for, ppl really should start reading up on their technology before rejecting it, there is nothing scary about the GAC. BTW. Tridion deploys some of its DLLs to the GAC too, and they didn't complain about that now did they? Commented Aug 8, 2013 at 7:37
2

Try adding it as ContentType.Text

1
  • 1
    doesn't that escape < and > into &lt;and &gt;? Commented Aug 7, 2013 at 8:24
2

If you use ContentType.Text as Eric answered, then < and > are going to be escaped as &lt; and &gt; as Bart states.

Then you can use another c# Template after the DWT template, to unescape those characters as we usually use with a TBB like:

Item salida = package.GetByName(Package.OutputName);

string strSalida = salida.GetAsString();
strSalida = strSalida.Replace("&lt;","<");
strSalida = strSalida.Replace("&gt;",">");
strSalida = strSalida.Replace("&quot;","'");

package.Remove(salida);
salida.SetAsString(strSalida);
package.PushItem("Output", salida);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.