Hi,
I have a requirement which needs a counter integer variable to be incremented in loop or a flag variable to be set to 0/1 or true/false. I've to show 1st item using some UI and the rest of the items with another UI. How can I achieve using sightly? I have referred tutorials but no where mentioned how to create a variable in sightly as <c:set var="variableName" value="variableValue"/> in JSTL. Please help me in this.
Thanks,
Arya.
Solved! Go to Solution.
You can do that like this...
<div data-sly-test.yourName="${currentPage.name}" data-sly-unwrap></div>
Now you do things like
<div data-sly-test="${yourName}">....${yourName}</div>
best,
Feike
You can do that like this...
<div data-sly-test.yourName="${currentPage.name}" data-sly-unwrap></div>
Now you do things like
<div data-sly-test="${yourName}">....${yourName}</div>
best,
Feike
Hi Feike,
Not sure if this is how it is supposed to work. If it is, how do I get my code working?
I have a requirement as below:
<div d-automode="${obj.message}"> <p>Content goes here</> </div>
The value of ${obj.message} is either 'true' or 'false'. But, when the value is false, sightly completely removes the attribute 'd-automode' and the resulting HTML is as below:
<div> <p>Content goes here</> </div>
How do I set value of 'false' in this attribute?
Cheers,
ashtrick
Views
Replies
Total Likes
Feike Visser wrote...
You can do that like this...
<div data-sly-test.yourName="${currentPage.name}" data-sly-unwrap></div>
Now you do things like
<div data-sly-test="${yourName}">....${yourName}</div>
best,
Feike
Hi Feike,
Thanks. It worked for me. For setting purpose this is ok. But we can't increment a variable in sightly. Also we can't check whether an object is null or not. I tried to check whether the object is null or not. But I got errors. Adobe has to provide these features. I think some background work is going on to implement these features. We can follow this for time being. I hope soon they will answer all these questions/issues related to Sightly.
Thanks,
Dinakar.
Views
Replies
Total Likes
hi,
Give me your example, where you get these errors.
Indeed you can't increment a counter, you should use a use-class for that.
Checking for null can be done like data-sly-test="${objectToBeChecked}
best,
Feike
Views
Replies
Total Likes
Hi Feike,
I tested like this -> data-sly-test="${objectToBeChecked != null}"
I got errors.
Thanks,
Arya.
Views
Replies
Total Likes
Already tried, no luck
Views
Replies
Total Likes
just use this data-sly-test="${objectToBeChecked}" or data-sly-test="${!objectToBeChecked}".
cheers,
Feike
Views
Replies
Total Likes
<div data-sly-test.message="${'false'}"></div>
${message}
<div d-automode="${message ? 'true' : ' false '}">
<p>Content goes here</>
</div>
Views
Replies
Total Likes
Thanks Feike.
I have created a separate thread for this problem. Will continue this discussion there. Below is the link
-A
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies