1

I have implemented a Web site by using DD4T Java version 2. I'll enable inline editing on the Web site. Our requirements are following.

  • Enable inline editing for all fields
  • Only output inline editing markup on staging Web site, and not live Web site.

To enable inline editing, I'll add org.dd4t.springmvc.siteedit.SiteEditService class's methods to JSP. It looks like following code(I omit some Java code to shorten it).

<h1>
<%= generateSiteEditFieldMarking() %>${heading}
</h1>

generateSiteEditFieldMarking method output "Start Component Field" comment and enbles inline editing. Also the method output the comment only if site edit is enabled on siteeditsettings.xml, that means it doesn't output any markup on live Web site.

But if two fields value are included in one tag, following code doesn't enable inline editing on "message" field.

<h1>
<%=generateSiteEditFieldMarking() %>${heading}
<%=generateSiteEditFieldMarking() %>${message}
</h1>

In this case, I have to add a html tag(span) which includes each field, like following code. I'm afraid those "span" tags will be output even on live Web site.

<h1>
<span><%=generateSiteEditFieldMarking() %>${heading}</span>
<span><%=generateSiteEditFieldMarking() %>${message}</span>
</h1>

How is it possible not to output any inline editing mark up on live Web site?

  • Which DD4T Maven version are you using ? – Raimond Jan 19 '16 at 13:42
  • For dd4t version 2.0.1-beta and lower, you can check the siteeditsettings.xml file and set "enabled" to false. For 2.0.2, I'd recommend to have a look at the xpm.tld file – Raimond Jan 19 '16 at 13:46
  • @Raimond I think the question is about not outputting the span tags which are only necessary for inline editing. – Rob Stevenson-Leggett Jan 19 '16 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.