Hello,
I am trying to have build a page template that will accept different types and quantities of sections snippets.
Basically I want to be able to use the same section snippet multiple times in single template, along with other snippets.
In the case of my screenshot below, I would have multiple projects (Project-name-one, Project-name-two
, etc) each using the same template (project.php
), and inside each project I would like to be able to reuse the same section snippet more than once, in this case: (section-type-one
) twice, and then (section-type-two
) once. But ultimately the projects will each be a made of a mixture of many different section snippets…
I have tried using the following code inside my project.php
template file :
<?php
foreach($page->children() as $section) {
snippet($section->uid(), ['data' => $section]);
}
?>
I got the code almost as is from the walkthrough about building one pagers. But it only allows me to use each section type once. If I reuse the same section again, it only uses the last one and ignores the others.
Anyone got any ideas ?
Thanks!