trouble using [apr field=] inside [apr_loop]
-
Chester –
I’ve been thrashing this one about for a while, now.
This is still with the Wardrobe base. I have an Outfits table where each record contains a field, Garment, that is a link to multiple records in the Garments table. In turn, each Garment record contains an Images field that is an attachment field containing zero to many images.
I am currently working on an Outfit display screen driven by a VirtualPost matching a single Outfit record. On this screen, I want to loop through all Garments linked from the Outfit and display per-Garment data. I do this by first populating the related record:
[apr_populate field="garment" relatedTo="garments"]
. I then call[apr_loop field="garment"]
. Within the loop I specify Garment fields using the {{}} syntax; everything works fine.If I want, I can also display all images associated with the Garment by means of a nested loop:
[apr_loop1 field='images']
. Within this second loop, I can access fields from each Garment>images instance, again using {{}} syntax. However, what I cannot seem to do is access only a single Garment image — even though v 1.34 of Airpress is supposed to support[apr field=]
within[apr_loop]
s.If I call
[apr field="garment|image|url" single]
from inside the loop, if the shortcode is embedded within html — for instance, as in<img style="max-height: 50px;" src="[apr field='garment|image|url' single]">
— the shortcode is replaced by theRECORD_ID
of the current Garment. If the shortcode is not embedded within an HTML declaration but is still inside the loop, it simply disappears — that is, is replaced by nothing.Outside of the loop, but still after the call to
[apr_populate]
, the shortcode is again replaced by theRECORD_ID
if called from within an HTML declaration. However, if called outside of the loop and outside of an HTML declaration, the shortcode[apr field='garment|image|url' single]
is replaced by the appropriate URL. (Of course, since that only works outside HTML, it doesn’t do much good.)If I call a comparable Outfit-level shortcode outside of the
[apr_populate]
block, it is replaced by the appropriate URL — both inside and outside of HTML declarations.As best I can tell, there is no way to specify ‘single’ while using {{}} syntax.
I’ve tried to trace through the code to see if I could find something to tweak, but as I’m not using an IDE, trying to follow routine execution using nothing but
airpress_debug()
statements is slow and painful — especially when I can simply ask the guy who wrote the thing!If I can provide any additional info, don’t hesitate to ask.
Thanks,
maz
- The topic ‘trouble using [apr field=] inside [apr_loop]’ is closed to new replies.