Sightly - Include another HTML and pass parameters | Community
Skip to main content
Level 3
October 16, 2015
Solved

Sightly - Include another HTML and pass parameters

  • October 16, 2015
  • 11 replies
  • 14097 views

Hi smiley

I'm wondering if this is possible?

I have a component (xcomponent) and have the two sightly templates in this as follows

  1. xcomponent.html
  2. y.html

​I'm using JAVA-USE API to get the data for the template and including the y.html in xcomponent.html as below

<div data-sly-use.componentService="XComponentProxy" data-sly-test="${componentService}" data-sly-unwrap=""> <div data-sly-test.componentData="${componentService.componentData}" data-sly-unwrap=""> <!-- Template HTML goes here --> <!-- Template HTML goes here --> <!-- Template HTML goes here --> <div data-sly-include="y.html" data-sly-unwrap="${!(wcmmode.edit || wcmmode.design)}"></div> </div> </div>

Can someone please help me on how to pass the parameters from xcomponent.html to y.html so that I can use componentData created in xcomponent in y.html?

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 Feike_Visser1

hi 

I would you data-sly-template for this, you can define templates in a separate file and can pass in parameters.

http://docs.adobe.com/docs/en/aem/6-0/develop/sightly.html#template & call 

11 replies

ashtrickAuthor
Level 3
October 16, 2015

That sounds like the best idea. I will surely implement this.

Thank you Gabriel for your help.