Hi PMS,
thanks for splitting my post. I wasn’t sure if I should post there or open a new thread
Btw, it came to my mind that I had to istantiate the yams class, but I asked here because I thought that YAMS plugin istantiated it for me, and then I was able to use it. So, it’s a simple problem
I’ve got to use it because we are in this situation.
We built our site with 2 main templates:
- a "folder" template;
- a "leaf" template.
Each document that is a container (i.e., every document in the site tree that isn’t a leaf) uses the "folder" template, it is formed by blocks, that are made with divs; each block represents a "child" page, giving a small description, a link to the page, sometimes a small static image, and rarely a links’ list of "grandchilds" made with ditto or wayfinder, or a slideshow using maxigallery.
Each document that isn’t a folder (i.e. that is a leaf) uses the leaf template, nothing strange here.
We studied a way to easily manage these blocks using the MODx manager: you can choose if the link to the page is above or under the description, if the image has to be on the left or on the right of the block, you can choose which percentage of the page this block has got to take, you can choose if you want a bigger or a smaller link, etc.
This is achieved with TVs: you set them, and then the changes appears on screen.
Here comes my snippet: it simply reads all the TVs values and builds the html for each block.
The entire page (i.e., all the blocks) is built with ditto: my snippet is simply called by the &dittoTpl chunk.
I use $modx->makeUrl() in my snippet to output the href in each block.
I don’t know if this is the better way to achieve the desired result: it works and at the moment I really don’t have time to get my head again on this.
If you have ideas, they’re really appreciated