I’m currently creating a book page and there is a subpage for each book with information about the books and links to specific shops.
For each link I did the following:
I created a TV called „shop-link-1“ (Example):
Than I created a chunk called „shop-link-1“:
← a href = " [[*shop-link-1]] " target=“_blank”> Shop</a →
After this I created a chunk called „buy“ for all the links:
Then I called the chunk [[$buy]] an the subpage and it worked.
Now I want to show the bookcover und the links together with other books on a mainpage. Therefore I created a tpl:
<img class="img-fluid" src="[[+tv.book-cover]]" alt="[[+tv.book-alt-text]]"
Here I want to show the shop links from the subpage. But I don’t know, how I call the content of a chunk [[$buy]] ? So I have to do it for the other books too.
</div><!-- row -->
Can someone help?
I am an absolute beginner. I found the chunk in my example in a forum und used it. I have no idea of writing a chunk or php on my own.
Are you using the snippet getResources (or maybe pdoResources) for this?
I’m not sure I understand your question correctly, but the problem is probably, that a tag like
[[*shop-link-1]] (you use in the chunk) is only for the TV-value of the requested resource.
If you list content from other resources on a page with getResources, then you have to use placeholder tags (like
So you probably have to create a new chunk with code like this
[[+tv.shop-link-1:notempty=`<a href="[[+tv.shop-link-1]]" target="_blank">Shop</a>`]]
and use that to show the ‘buy’-links in the book list. (Or just add the code to the existing “tpl”.)
I’m using getResource.
Thanks a lot for your help. I have tested your solution und I think it worked.