Hi,
For our project we want to restrict editing of some components like Header and Footer only to the home (root) page of a Web site.
In other words, in the Touch UI, these components can be edited only if the page that is currently being edited is the home page of the current web site.
Also it should not be possible to edit and override Header and Footer in child pages.
Is there a way to create/configure suchlike components in CQ 5.6 out of the box?
Thanks in advance.
Solved! Go to Solution.
What I typically in this scenario is add code in my templates that checks the current page's level and unless the page is at say level 4, or is of a particular template type I change the edit mode to disabled before including the component and switch it back to edit afterwards.
<% boolean changed = false; if (WCMMode.fromRequest(request) == WCMMode.EDIT && page.getDepth() > 3) { WCMMode.DISABLED.toRequest(request); changed = true; } %> <cq:include path="mycom" resourceType="mysite/components/mycomp" /> <% if (changed) { WCMMode.EDIT.toRequest(request); changed = false; } %>
Now that's a lot of scriptlet so I always create a custom tag to do that for me.
What I typically in this scenario is add code in my templates that checks the current page's level and unless the page is at say level 4, or is of a particular template type I change the edit mode to disabled before including the component and switch it back to edit afterwards.
<% boolean changed = false; if (WCMMode.fromRequest(request) == WCMMode.EDIT && page.getDepth() > 3) { WCMMode.DISABLED.toRequest(request); changed = true; } %> <cq:include path="mycom" resourceType="mysite/components/mycomp" /> <% if (changed) { WCMMode.EDIT.toRequest(request); changed = false; } %>
Now that's a lot of scriptlet so I always create a custom tag to do that for me.
Hi,
this is probably what you want: http://dev.day.com/docs/en/cq/current/developing/boilerplates.html
scott
Views
Replies
Total Likes
orotas wrote...
What I typically in this scenario is add code in my templates that checks the current page's level and unless the page is at say level 4, or is of a particular template type I change the edit mode to disabled before including the component and switch it back to edit afterwards.
<%
boolean changed = false;
if (WCMMode.fromRequest(request) == WCMMode.EDIT && page.getDepth() > 3) {
WCMMode.DISABLED.toRequest(request);
changed = true;
}
%>
<cq:include path="mycom" resourceType="mysite/components/mycomp" />
<%
if (changed) {
WCMMode.EDIT.toRequest(request);
changed = false;
}
%>
Now that's a lot of scriptlet so I always create a custom tag to do that for me.
Sorry, I am new to CQ. In my component's template I do not have <cq:include>, but just the component markup. Something like this:
<% boolean changed = false; if (WCMMode.fromRequest(request) == WCMMode.EDIT && page.getDepth() > 3) { WCMMode.DISABLED.toRequest(request); changed = true; } %> <% // some scriptlets %> <div class="my-component"> <!-- some markup --> </div> <% if (changed) { WCMMode.EDIT.toRequest(request); changed = false; } %>
Would this solution work if I wrap my code inside the scriptlet you've shown?
UPDATE: I tried this and it works as expected. Thanks.
Views
Replies
Total Likes
Yes, Create one admin header and footer page under tools by using a template.Add your component and give content details. After that you can easily show all those values on other pages by fetch content from nodes.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies