Hi,
I have a getResources call that has tpl and tplOdd params set so that I can assign a class to every other result (it’s a list of products).
Inside each of the template chunks named by these params there’s a call to another chunk [[$productListing]] which handles all the product data : I’ve done it this way so that I only need to manage this chunk if I need to amend the layout.
What I get is the correct number of products for my getResources call, but the same product information repeated each time. If I switch off the tpl params, I can see that the raw output is correct.
If I remove the [[$productListing]] call and instead replicate the code within both templates it’s fine, but there’s obviously a maintenance overhead.
Anyone got any ideas? I suspect I’m misunderstanding something around the order of execution...
tpl chunk:
--------------
<li>
[[$productListing]]
</li>
--------------
tplOdd chunk:
--------------
<li class="odd">
[[$productListing]]
</li>
--------------
thanks
Chris
I’m not sure I understand you, but maybe this will help. [[$productListing]] will just show the contents of that chunk (which won’t change). The only way that getResources can show data from a particular resource is with placeholder tags [[+field/TV name]], so your Tpl chunks need to have some placeholders in them (or in the productListing chunk). If you have placeholder tags in the productListing chunk, try making them and the chunk tag uncached:
[[!$productListing]]
[[!+field/TV name]]
Hi Bob,
Thanks for coming back. Sorry - should have pointed out that I have placeholders in the chunk, and had tried calling the chunk and placeholders uncached already.
Not to worry - I can just maintain the 2 pieces of code, it’s not a big overhead.
thanks
Chris
If you have a significant number of products, at some point you’ll probably want to put the product data in a separate DB table and use a snippet and one or more Tpl chunks to display it.