I'm having trouble displaying a channel entry loop within my EE setup which uses the Stash and IfElse modules. First of all, see this screenshot of my file structure:
I'm using the 'partials approach' (heavily based on this article) and therefore have an index.html file which handles my routing.
index.html:
{!-- If we're on one of the main support pages --}
{if segment_2!="" AND segment_3==""}
{embed="support/main-landing"}
{!-- If we're on one of the Financial Support sub-pages --}
{if:elseif segment_2=="financial-support" AND segment_3!=""}
{embed="support/main-detail"}
{/if}
So if we look at the main-landing template file, you can see that I'm specifying the stash layout file to use and also setting some variables - one for the actual landing page itself and the other for the loop I am having trouble displaying.
main-landing.html:
{stash:embed:layouts:support-main-landing}
{!-- Set data for the landing page --}
{exp:channel:entries channel="support" url_title="{segment_3}"}
{exp:stash:set}
{stash:url_title}{url_title}{/stash:url_title}
{stash:title}{title}{/stash:title}
{stash:page_content}{page_content}{/stash:page_content}
{/exp:stash:set}
{/exp:channel:entries}
{!-- Set data for the financial support sub-pages --}
{exp:stash:set_list name="financial_support_options" parse_tags="yes"}
{exp:channel:entries channel="financial_support"}
{stash:financial_url_title}{url_title}{/stash:financial_url_title}
{stash:financial_title}{title}{/stash:financial_title}
{stash:financial_page_content}{page_content}{/stash:financial_page_content}
{stash:financial_summary}{summary}{/stash:financial_summary}
{/exp:channel:entries}
{/exp:stash:set_list}
The following layout file then gets the loop that we just set, using get_list
.
support-main-landing.html:
{stash:embed:wrappers:main} {!-- Select the main wrapper template --}
{exp:stash:set name="content"} {!-- Set everything in between here as the content --}
{stash:embed:partials:breadcrumb}
<div class="efc internal main-content">
<div class="container entry">
<div class="col-md-8">
<h4>{exp:stash:get name='title'}</h4>
<div class="row financial-options">
{exp:stash:get_list name="financial_support_options"}
<div class="col-md-6">
<p><strong><a href="financial-support/{financial_url_title}">{financial_title}</a></strong></p>
<p>{financial_summary}</p>
</div>
{/exp:stash:get_list}
</div>
</div>
<div class="col-md-4">
{!-- If we're on the Financial Support page, show it's unique sidebar --}
{if segment_2=="financial-support"}
{stash:embed:content:sidebar-financial-support}
{/if}
</div>
</div>
</div>
{/exp:stash:set}
The Problem:
Everything seems to be working except for the loop financial_support_options
. When the page is rendered, it manages to display the surrounding <div class="row financial-options">
but no data inside...so the problem must lie where I am actually setting the loop variable in main-landing.html.
FYI - The financial-support channel and support channel both use the same Channel Field Group
Do you absolutely HAVE to set the tags as stash variables in order to use them within the layout files in the stash folder?
Any help will be greatly appreciated!