Hi, I was wondering if anybody could maybe give me some clues/pointers to help with the following?
There is a section of a website which I am developing which should have the following structure:
1. The
section home page, which includes a block of user-typed content (ie, the resource content of the page), and a non-user-editable block of content (which I assumed I’d include as a snippet in the template) consisting of
(
foreach child page within this section of the website):
* an image for that child page,
* the title of that child page,
* the [~id~] of that child page (for making a link)
* the 1st paragraph of that child page’s text (obtained from (how?) the resource content of that child page).
2. The
child pages within the section, each consisting of:
* a block of user-typed content (ie, the resource content, as also noted above)
* a number of blocks of non-user-editable content obtained from a database, specific to each page
There is only one level of child pages, and there are about 10 child pages in total.
What I’d like to do is have just one template for this section (or perhaps ’section home’ template, and ’section subpage’ templates if need be), and have the template work in such a way that the appropriate dynamic/database content can be handwaved magically into being..
I will need to write a snippet to bring in the database-driven content (which is not a problem), but I was wondering how I could have my snippet magically detect which page is actually calling it (eg, I guess passing the page ID into the snippet somehow - is that possible?), so that it can then assemble the appropriate database query parameters for each of the pages?
Thanks for any advice.
(I’m using MODx Evolution.)