How to use cq:noDecorator property in cq5 , can the default 'div' tag be changed to other block tags

旧城冷巷雨未停 提交于 2019-12-06 15:19:55

To change the default div tags to something else , use cq:htmlTag nodes in your components. This lets you modify the tag , classes and id associated with the decorator tag.

  • Create cq:htmlTag node [primaryType:nt:unstructured] under your component.
  • Add cq:tagName property [type:String] with the tag to be used as value.
  • Add class property [type:String] with class(es) to be added to the enclosing tag **
  • Add id property [type:String] with id to be added to the enclosing tag

    ** CQ will add an extra class of its own.

Source : http://experiencedelivers.adobe.com/cemblog/en/experiencedelivers/2013/04/modify_the_auto-generateddivs.html

You can wrap them in an if statement. Using JSTL:

<%
if (WCMMode.fromRequest(request) == WCMMode.EDIT) {
%>
<div>
<%
}
%>

Of course you shouln't use java code in the JSP directly, but rather put it in a request variable and use JSTL:

<c:if test="${isEditMode}">
<div>
</c:if>

If you want to get rid of the automatic generated divs, you would need to combine this with the noDecorator property and add the edit dialog script by other means within your optional divs.

Yogesh Upadhyay

You can also use this

<%
   if (WCMMode.fromRequest(request) != WCMMode.EDIT && 
        WCMMode.fromRequest(request) != WCMMode.DESIGN) 
   {
       IncludeOptions.getOptions(request, true).forceSameContext(Boolean.TRUE);
   }
%>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!