Hi all
I’m working on an EE site using Michael Boyink’s excellent Building an ExpressionEngine 2 Site as a guide. I have several template groups set up which follow the section structure of the site (technical-information, water-supplies, news, etc). There’s some template code repetition between the technical-information and water-supplies index template; I’m thinking that for the navigation menu within each section it could be possible to use a more DRY approach. The current template code for the technical-information index template is:
{embed="embeds/html_header"}
{embed="embeds/page_header"}
<div class="main-menu-outer">
<div class="main-menu-centered">
<ul class="main-menu-basic main-menu-advanced">
{exp:channel:entries channel="technical_information" disable="categories|member_data|pagination" dynamic="no" sort="asc" offset="1"}
<li{if count == total_results} class="last"{/if}>
<a href="http://{path=">{title}</a>
</li>
{/exp:channel:entries}
</ul>
</div>
</div>
<div id="main-content">
{exp:channel:entries channel="technical_information" disable="categories|member_data|pagination" sort="asc" limit="1"}
<h1>{standard_main_page_heading}</h1>...The menu code inside <div class=“main-menu-outer”> is repeated in the water-supplies index template but with {exp:channel:entries channel="water_supplies"
This works fine but if there is a way of replacing "technical_information" with some code that automatically inserts the channel of the current entry being viewed, I could move the code into the {embed="embeds/page_header"} and have it in just one template file.
I’ve not found any info on the possibility or otherwise of pulling the current entry channel into EE code dynamically. Is it possible or should I just stick with the current solution?
Thanks in advance for your help