Thanks, Jay, I think that’s answered my initial question: if placeholders are parsed after chunk calls, then what I’m doing isn’t going to work.
So the next question is "is there another way to achieve the same thing"? Maybe I should expand a bit on what I’m trying to do...
OK, so the site I’m building here is a webstore for a small press publisher. The Ditto call shown above is calling for the set of resources which each represent a single title; however, each title (Book X by Joe Y) can have between one and three different ’states’ or editions, each of which has a different price.
Now, the resource for each book has a radio-button TV [*numberOfStates*], the output of which is used to call one of three different chunks when that resource is displayed; these three chunks are FoxyCart buy-link forms customised for the number of different editions the book has. Eg, if [*numberOfStates*] is set to ’1’ in the Manager, it outputs the string "oneStateBuyFormChunk"; set to ’2’, it outputs "twoStateBuyFormChunk". In the resource template, those strings are inserted into a chunk call thusly: {{[*numberOfStates*]}}, so that a form with the necessary options to select from the available editions is displayed. This works just fine.
Now, back to the Ditto call, which is supposed to produce a browseable and paginated list of books in the catalogue. These are coming out just fine, but I want to put the same FoxyCart buy forms in each book listing, so the customer doesn’t have to click through to the actual resource for the title to be able to add it to their cart. Because we’re working with Ditto, I have to use placeholders instead of TV calls, so I’ve cloned the chunks that output the buy forms to versions that use placeholders.
Example: this is {{oneStateBuyFormChunk}}:
<form action="https://xxxx.foxycart.com/cart" class="foxycart" method="post">
<input type="hidden" name="name" value="[*bookTitle*]" />
<input type="hidden" name="category" value="[*freeShipping*]" />
<select name="state">
<option value="[*firstState*]{p:[*firstStatePrice*]}">[*firstState*] - £[*firstStatePrice*]</option>
</select>
<input type="submit" value="Buy It Now!" />
</form>
And this is {{oneStateBuyFormChunkDitto}}:
<form action="https://xxxx.foxycart.com/cart" class="foxycart" method="post">
<input type="hidden" name="name" value="[+bookTitle+]" />
<input type="hidden" name="category" value="[+freeShipping+]" />
<select name="state">
<option value="[+firstState+]{p:[+firstStatePrice+]}">[+firstState+] - £[+firstStatePrice+]</option>
</select>
<input type="submit" value="Buy It Now!" />
</form>
If I just drop {{oneStateBuyFormChunkDitto}} directly into the Ditto template, it displays just fine. The problem is that I need to switch between chunks in that position depending on the value of [+numberOfStates+] for each individual Ditto result, in order to present the option to buy any edition of the book from the dropdown list. But as Jay has pointed out, the chunk call is parsed before the TV placeholder, which at that point in proceedings doesn’t contain a valid chunk name, and so no buy form appears in the Ditto results at all.
I’m suspecting now that what I need to do probably involves some sort of snippet wizardry, but I’m uncertain of how I’d go about setting the right chunk call for each Ditto result. Can anyone suggest a way to do it? Or (better still, and probably more likely given I’m a self-taught n00b at PHP) is there a method that circumvents the issue entirely?