How to access Gloabal objects in HTL | Community
Skip to main content
New Participant
October 12, 2016
Solved

How to access Gloabal objects in HTL

  • October 12, 2016
  • 3 replies
  • 1106 views

I have gone through the documentation in below url about Global objects in HTL:

https://docs.adobe.com/docs/en/htl/docs/global-objects.html.

 

I need to change the below existing code in JSP to Sightly(HTL):

<%

 if (WCMMode.fromRequest(request) == WCMMode.EDIT){
            %><img src="/libs/cq/ui/resources/0.gif" class="cq-carousel-placeholder" alt=""><%
        }

%>

I want to access the wcmmode and the request object directly in sightly without using the Java class. However I am facing issues in doing that. Could someone provide me the way(syntax) to access the objects directly in HTL ?

Thanks.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

Check the HTL spec here: 

https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/master/SPECIFICATION.md

For example: 

<div data-sly-test.isEditMode="${wcmmode.edit}">${isEditMode}</div>

Hope this helps.... 

3 replies

nalla0109Author
New Participant
October 12, 2016

Thanks a lot it worked. I was using the upper case thats why it didn't work.

Feike_Visser1
Employee
October 12, 2016

<img data-sly-test="${wcmmode.edit}" src="/libs/cq/ui/resources/0.gif" class="cq-carousel-placeholder" alt="">

smacdonald2008
smacdonald2008Accepted solution
New Participant
October 12, 2016

Check the HTL spec here: 

https://github.com/Adobe-Marketing-Cloud/htl-spec/blob/master/SPECIFICATION.md

For example: 

<div data-sly-test.isEditMode="${wcmmode.edit}">${isEditMode}</div>

Hope this helps....