Hi all,
I'm currently working on building a site that houses several pages, each of which is rather long and contains multiple, vertically-stacked subsections. Each subsection has varying content and layout - for example, one subsection might house an image with description and some copy, the next might contain a form and a sidebar, the next might contain copy only, etc. These subsections never get linked to, and don't exist as 'pages' on their own; they're just varying pieces of content within a larger page.
What I'm looking for is a method that allows me to create individual resources for each subsection and then render the subsection inline on the page using the resource's template itself. I have achieved something similar in the past by using getResources and the value of a template variable within each resource to conditionally determine which tpl chunk to use, but this method is a little cumbersome as it uses one template (and set of template variables) for all resources, and necessitates editing chunks to alter the formatting of each resource type, which is much less convenient than simply specifying different templates for each resource and having those determine the formatting of the output.
Is there some way to force getResources to display content using the resource template itself rather than rendering using a tpl chunk? If not, is there another snippet that allows this, or some simple PHP-based method of achieving the same?
Interesting approach. It seems a little circuitous, but definitely a clever way to solve the problem. I'll give that a try, thank you.
Although, thinking about it, won't this necessitate re-saving each resource after every change to the template?
Ah, perfect, thank you! I knew there had to be something out there to meet such a basic need.