Hello Couch enthusiasts! I'm having a real problem with getting the var used to set an image link to let go of the var it just set iterating through the remaining <pages> and I have no clue why.
There are 3 choices user can make: artist(2), album(1), track(0) - these trigger their own template and respective editables.
If 'track.php's editable 'image' field which is called 'nca_trk_sngl_elem_img' is empty, then I want to show the image for the album for which it is related (from type='relation' editable).
This part works as expected.
If nca_trk_sngl_elem_img field has info, I set the var to that field:
This also works as expected.
But what happens is that once the var is set due to the track.php's image field being populated (as opposed to empty), this image continues on for every image link for the rest of the <pages> iterations with empty track.php image fields (that would normally go thru the <related_pages> path). If track.php's image editable field is empty, it doesn't follow the "if" conditional of being empty, the image that populated from track.php's image editable will persist. If track.php's field is populated on the new iteration, then the var sets to that field, but now, that image will persist.
I have tried <cms:if nca_trk_sngl_elem_img=""> and <cms:if "<cms:not nca_trk_sngl_elem_img />" > (as you see below) and <cms:if "<cms:not_empty nca_trk_sngl_elem_img />" > when checking track.php's image editable being empty.
and I get the same results each time.
Am I not asking if the image field is empty in the right way? Is there another way to check 'empty' fields?
Happy to hear any feedback on this.
There are 3 choices user can make: artist(2), album(1), track(0) - these trigger their own template and respective editables.
If 'track.php's editable 'image' field which is called 'nca_trk_sngl_elem_img' is empty, then I want to show the image for the album for which it is related (from type='relation' editable).
- Code: Select all
<cms:set crnt_crd_stk_sbj_plyr_sdbr_img="<cms:thumbnail nca_alb_inf_img />" "global" />
This part works as expected.
If nca_trk_sngl_elem_img field has info, I set the var to that field:
- Code: Select all
<cms:set crnt_crd_stk_sbj_plyr_sdbr_img="<cms:show nca_trk_sngl_elem_img />" />
This also works as expected.
But what happens is that once the var is set due to the track.php's image field being populated (as opposed to empty), this image continues on for every image link for the rest of the <pages> iterations with empty track.php image fields (that would normally go thru the <related_pages> path). If track.php's image editable field is empty, it doesn't follow the "if" conditional of being empty, the image that populated from track.php's image editable will persist. If track.php's field is populated on the new iteration, then the var sets to that field, but now, that image will persist.
I have tried <cms:if nca_trk_sngl_elem_img=""> and <cms:if "<cms:not nca_trk_sngl_elem_img />" > (as you see below) and <cms:if "<cms:not_empty nca_trk_sngl_elem_img />" > when checking track.php's image editable being empty.
and I get the same results each time.
Am I not asking if the image field is empty in the right way? Is there another way to check 'empty' fields?
- Code: Select all
<cms:pages masterpage=crnt_crd_stk_sbj_plyr_sdbr limit='8' >
<li>
<a href="<cms:show k_page_link />" class="d-flex align-items-center">
<cms:if nca_crd_stk_sbj_plyr_sdbr_opt='2'>
<cms:set crnt_crd_stk_sbj_plyr_sdbr_img="<cms:thumbnail nca_arts_elem_img width='150' />" />
<cms:else_if nca_crd_stk_sbj_plyr_sdbr_opt='1' />
<cms:set crnt_crd_stk_sbj_plyr_sdbr_img="<cms:thumbnail nca_alb_inf_img width='150' />" />
<cms:else />
<cms:if "<cms:not nca_trk_sngl_elem_img />" >
<cms:related_pages 'nca_trk_elem_track_albums_rel' >
<cms:set crnt_crd_stk_sbj_plyr_sdbr_img="<cms:thumbnail nca_alb_inf_img />" "global" />
</cms:related_pages>
<cms:else />
<cms:set crnt_crd_stk_sbj_plyr_sdbr_img="<cms:show nca_trk_sngl_elem_img />" />
</cms:if>
</cms:if>
<img src="<cms:show crnt_crd_stk_sbj_plyr_sdbr_img />" alt="<cms:show k_page_title /> Image" class="img-fluid mr-2">
<div class="podcaster">
<span class="d-block"><cms:show k_page_title /></span>
<span class="small">
<cms:if nca_crd_stk_sbj_plyr_sdbr_opt='2'>
<cms:show nca_arts_elem_pg_rol />
<cms:else_if nca_crd_stk_sbj_plyr_sdbr_opt='1' />
Rel: <cms:show nca_alb_inf_rel_dt />
<cms:else />
<cms:related_pages 'nca_trk_elem_track_albums_rel'>
<cms:show k_page_title />
</cms:related_pages>
</cms:if>
</span>
</div>
</a>
</li>
</cms:pages>
Happy to hear any feedback on this.