Hi Need to understand what is meaning of below line of code
<div data-sly-resource="${@path='FirstDivHeader', resourceType='foundation/components/parsys'}">
What is Used of @path in ablove example.
That is for manipulating the path of the resource. Please see the following document:
As per my understanding, this means rendering a resource which is located at path FirstDivHeader and has a resourcetype of "foundation/components/parsys"
More details below:
data-sly-resource
:
Includes a rendered resource from the same server, using an absolute or relative path. An implementation should create a new request context when retrieving the output.
Note: this is comparable to a
<jsp:include page="" />
.
<section data-sly-resource="./path"></section>
With an expression more options can be specified:
<!--/* Following statements are equivalent: */-->
<section data-sly-resource="./path"></section>
<section data-sly-resource="${'./path'}"></section>
<!--/* Manipulating the path: */-->
<section data-sly-resource="${'my/path' @ appendPath='appended/path'}"></section>
<section data-sly-resource="${'my/path' @ prependPath='prepended/path'}"></section>
<!--/* Manipulating selectors: */-->
<section data-sly-resource="${'my/path' @ selectors='selector1.selector2'}">
</section> <section data-sly-resource="${'my/path' @ selectors=['selector1', 'selector2']}">
</section> <section data-sly-resource="${'my/path' @ addSelectors='selector1.selector2'}">
</section> <section data-sly-resource="${'my/path' @ addSelectors=['selector1', 'selector2']}">
</section> <section data-sly-resource="${'my/path' @ removeSelectors='selector1.selector2'}"></section>
<section data-sly-resource="${'my/path' @ removeSelectors=['selector1', 'selector2']}"></section>
<section data-sly-resource="${'my/path' @ removeSelectors}"></section>
<!--/* Forcing the type of the rendered resource: */-->
<section data-sly-resource="${'./path' @ resourceType='my/resource/type'}"></section>
The scope of the data-sly-resource
statement isn't passed to the template of the included resource.
Views
Replies
Total Likes
HI,
The use of "path" attribute in "data-sly-resource" :
When a component with the above snippet is included in a page, we would see a parsys being displayed and when we add any components within the parsys placeholder, behind the scene in the CRXDE, we would see the components available in the node hierarchy like below.
Let's say the page path is /content/xyx/abc.html
In CRXDE, /content/xyx/abc/jcr:content/FirstDivHeader/componentname(that you would have included in that parsys)
In brief, it is part of the path with respect to the page where this snippet/component is being used.
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies