Hello
I would like to create a Template Variable and I provide access to my template.
I can see the TV in all ressources but I would like allowed only for one ressource.
The goal is the create an accordeon content. Each TV will contain the texte which will be collapse or not following the first h4, in the TV. I need about 7 TV for a ressource.
I might need to create a new accordeon for another ressource. That the reason why, I would like to make sure, the TV will be sown only for the selected ressource.
Is possible to grant access to the TV, not only to the template, but for a selected resspurces as well?
Another idea, would be to create a new template, which will be the clone of the âPagesâ template. Then I can apply the new template to one ressources, but I do not really like it, because if I make a change the the âPagesâ template, I do not have to forget to make the change to the new template, as wellâŚ
Or would it be possible to create. anew template, which will inherit from the âPagesâ template?
You could also do this with child pages of the resource that will have the accordion, instead of template variables. And then use a pdoResources or getResources or maybe getfield snippet to call the contents of the child pages into the accordion of the parent page.
The advantage would be the flexibility in being able to add or remove the number of child pages, and easily reorder them. The template for the child pages can be whatever you need, or empty. For instance with no template for the child pages you can utilize the existing fields; perhaps the *longtitle to populate the link text of the accordion and *content for the text to reveal.
Then do the same for any other resources that will have their own accordion section.
Dear Lucy,
Thatâs very interretsing.
For now I installed getRessource.
I created two child ressource of thge ressource with the id 33
I created a chunck named Accordeon33 where I pasted
<div>
[[getResources? &parents=`33`]]
</div>
In my resource 33, I called the chunck
[[$Arccordeon33]]
I refersh my page and I have an empty line. I am agree thatâs not the final solution, but should I get someting printed, isnât
I am very happy with the result, but I saw some problem.
First only the first 6 child ressource are shown.
If I unpublish the 5th child ressource (the goal was to six if the 6th child is shown whild the 5ft is unpublished), the unpublished child are still shown.
I wonder why the only the 5th first child are shown and not all of the 9 childs and how hidden the unpublished?
The above assumes you want to grab the content from the child pages of parent page, print each as a li, all wrapped in a ul. Change the HTML to whatever you need for your accordion markup.
If youâre not using the content field, and instead using a TV, you need to use the includeTVs property, and possibly others. Read more about getResources in the docs.
You would put the above snippet call in a chunk called myChunk for instance, and then call the chunk in your page template with a conditional.
Something like:
5 is the default for the &limit property.
You would do well to stop and carefully read the docs now. getResources is very flexible and configurable and you need to know all the defaults.
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting â+ New Topicâ.