I'm certain I'm either making a mistake or not understanding how the Assets tag should be working.
Within the Entry template, I was intending to use the Assets tag to loop through each of the entry's assets. For each asset, I would mark the matching alt text with a keyword ("dronfdronf"). Then I could do a regex_replace that replaced that image block with my improved block of HTML ("$new_image_block").
This works except it only marks the first asset returned by the Assets tag. Why is that?
<mt:Assets> <mt:var name="body_content" replace="$my_asset_label","DRONFDRONF" setvar="body_content" /> <mt:ignore> This still works: </mt:ignore> <mt:var name="body_content" regex_replace="/<span class="mt-enclosure .+?>(<a href="(.+?)">)?<img alt="(DRONFDRONF)" src="(.+?)" class="mt-image-(.+?)".+?</span>/g","$new_image_block" setvar="body_content" /> </mt:Assets><mt:var name="body_content" />
If I change the search text to match all alt texts, then the code replaces every single image with code for the first image.
...
regex_replace="/<span class="mt-enclosure .+?>(<a href="(.+?)">)?<img
alt="(.+?)" src="(.+?)"
is Assets not looping?
Reported on Movable Type 4.2
Assets loops, but also keep in mind that it's used for assets across the whole blog, not just related to that entry. For the entry itself, I'd recommend <mt:EntryAssets> instead. Be sure that if you're setting any custom variable values (and you want them to change in each iteration) that you set the value in each iteration. The system variables obviously change through each iteration, as appropriate.