Jim Bailie Posted December 1, 2022 Share Posted December 1, 2022 I'm sure this has been explained numerous times, but I'm struggling trying to find the best way to go about this scenario: So the user creates a new page and then is able to select from a drop-down, a number of pieces of existing content items that will render in the template in the order selected. I'm assuming these pieces of content will reside in their own individual, grouped pages without an associated template. In the main template I would then loop through these selected pages and output as desired. Link to comment Share on other sites More sharing options...
Gideon So Posted December 2, 2022 Share Posted December 2, 2022 Hi @Jim Bailie I think you can use the Page Reference field. And then loop the page reference field to show the content of the selected page. For example, I add a Page Reference field named other-page-content. I can add the following code to my main template <?php foreach($page->other-page-content as $other-page) { echo "<div>"; echo $other-page->your-content-field; echo "</iv>"; } Hope this help. Gideon 1 Link to comment Share on other sites More sharing options...
gebeer Posted December 2, 2022 Share Posted December 2, 2022 For the select dropdown you can use a Page Reference field (e.g. named "content_pieces") with Input field type AsmSelect. This will give you a sortable list of pages: As for grouping the pages that hold the pieces of content, you have multiple different options to go about. Here just 2 examples: put them under one parent: in content_pieces field settings, under setting "Selectable pages" choose that parent give all pages a checkbox field, named e.g. "content_piece", under setting "Selectable pages" choose "Selector string" and enter (without quotes) "content_piece=1" Now in your template PHP you can loop through and output the desired content. Assuming content is in field named "content": foreach ($page->content_pieces as $p) echo $p->content; 1 Link to comment Share on other sites More sharing options...
gebeer Posted December 2, 2022 Share Posted December 2, 2022 @Gideon So you posted just seconds before me ? 1 Link to comment Share on other sites More sharing options...
Jim Bailie Posted December 2, 2022 Author Share Posted December 2, 2022 Ugh, I knew it was this straight forward. Thank you both! @Gideon So @gebeer 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now