I have a snippet that I use on nearly every page of a site. I need to give the admins some control in the fallback source of an image in that snippet. Now I know there is a parse order issue here as it works fine when dropped directly into the template, I am just wondering if there is a workaround?
{exp:switchee variable="{segment_1}/{segment_2}" parse="inward"}
{case value="events/{segment_2}"}
{exp:low_variables:parse var="lv_fallback_banner"}
{exp:ce_img:pair src="{event_masthead}" height="270" min_width="1600" max_width="1600" fallback_src="{url}" crop="yes" allow_scale_larger="yes" filter="brightness,-80|grayscale|colorize,80,39,9,10"}style="background:url('{made}') no-repeat 50% 0; height: 270px;"
{/exp:ce_img:pair}
{/exp:low_variables:parse}
{/case}
{case value="member-directory/{segment_2}"}
{exp:low_variables:parse var="lv_fallback_banner"}
{member_photo_gallery limit="1"}
{exp:ce_img:pair src="{url}" height="270" min_width="1600" max_width="1600" fallback_src="{lv_fallback_banner}" crop="yes" allow_scale_larger="yes" filter="brightness,-80|grayscale|colorize,80,39,9,10"}style="background:url('{made}') no-repeat 50% 0; height: 270px;"
{/exp:ce_img:pair}
{/member_photo_gallery}
{/exp:low_variables:parse}
{/case}
{case default="yes"}
{exp:low_variables:parse var="lv_fallback_banner"}
{exp:ce_img:pair src="{masthead}" height="270" min_width="1600" max_width="1600" fallback_src="{url}" crop="yes" allow_scale_larger="yes" filter="brightness,-80|grayscale|colorize,80,39,9,10"}style="background:url('{made}') no-repeat 50% 0; height: 270px;"
{/exp:ce_img:pair}
{/exp:low_variables:parse}
{/case}
{/exp:switchee}
{exp:ce_img:pair ... fallback_src="{exp:low_variables:single var='lv_fallback_banner'}" ... parse="inward"}
as the CI Image opening tag. Make sure everything is on a single line. Having the :parse tag in a pair for a variable that needs extra processing (like Assets does with the{filedir_x}
vars), only works for single tags at the moment.