3

I see lot of reference to implement XPM (Xperience Manager) in DWT. But i would like to know that How to make this working in C# and DWT? Say for Ex: if my Final HTML will be like below:

<P>This is Text</P>

I will write C# TBB, to fetch the value from component and push the value to DWT, in DWT, i will be having like @@text@@

This works fine in templating. But i would like to enbale inline editing for this field. I have enabled the site edit for the site and tried to edit the text field which is not working for me.

When i search, i understand that i need to use below, which means, can't i edit the value which i pushed from C# TBB?

@@FieldStartMarker(Fields.Address.HouseNumber)@@

  @@FieldValueStartMarker()@@

   @@Field@@

  @@FieldValueEndMarker()@@

@@FieldEndMarker()@@

1 Answer 1

4

See also my answers here and here, what you need is to add the XPM markup in your output.

There are multiple ways you can generate that markup, in DWT (as you already mentioned), you would typically use the supplied Custom Functions. But now that you want to output the markup yourself, you will have to understand what those functions generate in DWT and replicate it yourself. Best way is to simply use a DWT TBB and check out what it generates for you.

Next thing I would like to point you to is the Tridion Practice site on Google code, it contains some sample code of how you could generate XPM markup from a C# Class (It is named UI2012, which was the name of SiteEdit/Experience Manager at that time, but the markup hasn't changed).

So please follow all three links I provided, in short, you will want to generate something like this:

<div>
  <!-- Start Component Presentation: {"ComponentID" : "tcm:1-2", "ComponentModified" : "2014-07-30T17:28:30", "ComponentTemplateID" : "tcm:1-3-32", "ComponentTemplateModified" : "2014-07-29T13:16:22", "IsRepositoryPublished" : false} -->    
  <div>
    <!-- Start Component Field: {"XPath" : "tcm:Content/custom:Content/custom:Text[1]"} -->
    <p>This is Text</p>
  </div>
</div>

The cherry on the cake might perhaps be this slide in the XPM workshop which I gave after the Tridion Developer Summit

2
  • Actually that "cherry" with the frosting on the next slide is quite nice as well, where string.Format() lets you call existing functions. Commented Jul 31, 2014 at 0:19
  • True, but keep in mind the string.Format() trick only works if you use DWT, if you don't have a DWT TBB at all, you can still create the correct markup, but you will have to do it all yourself. Commented Jul 31, 2014 at 8:22

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.