Can we use a data-sly-use in an html or anyother way along with an asset? | Adobe Higher Education
Skip to main content
Level 2
April 3, 2017
해결됨

Can we use a data-sly-use in an html or anyother way along with an asset?

  • April 3, 2017
  • 3 답변들
  • 1972 조회

I would like to execute a piece of code with all dam asset resources. How can I achieve this just like we do with a cq:Page? Any suggestions appreciated

 

Thanks 

Sanjay

이 주제는 답변이 닫혔습니다.
최고의 답변: Ratna_Kumar

Hi,

I think you can do it for asset too. See this below example code snippet.

mimetype.html

<div data-sly-use.asset="com.day.cq.dam.api.Asset">
  <p>${asset.mimeType}</p>
</div>

The data-sly-use statement directs HTL to adapt the current Resource to an Asset and give it the local name asset. It then calls the getMimeType method of Asset using the HTL getter shorthand: asset.mimeType.

See this below Adobe documentation for more reference:

//https://docs.adobe.com/docs/en/htl/docs/use-api/java.html

Hope this helps!

~ Ratna.

3 답변

Ratna_Kumar
Level 10
April 3, 2017

Hi,

I think you can do it for asset too. See this below example code snippet.

mimetype.html

<div data-sly-use.asset="com.day.cq.dam.api.Asset">
  <p>${asset.mimeType}</p>
</div>

The data-sly-use statement directs HTL to adapt the current Resource to an Asset and give it the local name asset. It then calls the getMimeType method of Asset using the HTL getter shorthand: asset.mimeType.

See this below Adobe documentation for more reference:

//https://docs.adobe.com/docs/en/htl/docs/use-api/java.html

Hope this helps!

~ Ratna.

smacdonald2008
Level 10
April 4, 2017