Use curleybars to insert an image into each topic list item
답변함I want to insert an image asset into each community topic list item conditionally in the community_topic_list_page.hbs. The syntax that I think I need to use is:
{{#if <topic id or name or ??>}}
<img src="{{asset.png}}" />
{{/if}}
It would be great if someone could provide me with a curleybars example with a short explanation of the method.
-
I figured it out so maybe this can help someone else. Here's how I did it. Obviously, replace XX...XX with your own page ID values (hint: it's in the URL) and add your own assets via the sidebar (the same place where the template files, script.js and styles.css is, look at the top) and copy the curlybars asset code.
<li class="blocks-item topics-item {{#if internal}}blocks-item-internal{{/if}}">
{{#is id XXXXXXXXXXXX}}
<img class="xxx" src="{{asset 'xxx.png'}}"/>
{{/is}}
{{#is id XXXXXXXXXXXX}}
<img class="xxx" src="{{asset 'xxx.png'}}"/>
{{/is}}...
</li>
-
Thanks for coming back and sharing how you solved this, Richard Barrett!
댓글을 남기려면 로그인하세요.
2 댓글