I am having an issue with an embedded template. I embed the template passing a "type" variable. Then, in the embed file it displays the content based on which "type" was specified. This all works, but either the parse order or Assets is causing hundreds of extra assets sql queries and ignores simple "type" conditional. It looks like EE parse order states that embedded variables are parsed early, so I am not sure why I am getting output from within other conditionals? If I comment out my Assets 2 code it cuts out most (if not all) the extraneous requests. (from ~500 to a normal 100ish at the moment).
Below is the embedded template. If I uncomment the cottage_photos fields my display is correct but they ALL get parsed across the board regardless of "type" conditional or Assets 2 limit param. I am new to Stack Exchange, so sorry if the code formatting is incorrect.
UPDATE As I keep testing, I really think its Assets and not parse order. When I comment out all the custom assets fields (cottage_photos below) all the issues are resolved. So, the question is why are the assets fields ignoring parse order and limit param?
{!-- GRID VIEW -----------------------------------------------------------------}
{if "{embed:type}" == "grid"}
{exp:channel:entries channel="cottage-rentals"
dynamic="no"
status="open"
paginate="bottom"
limit="12"
orderby="title"
sort="asc"
disable="categories|member_data"
}
{sn_pagination}
{if count == 1}
<ul id="cottage-grid" class="large-block-grid-4 small-block-grid-1">
{/if}
<li>
<div class="cottage">
<a href="{path='/accommodations/cottage-rentals/cottage'}/{entry_id}" class="leadin" title="Click here to view {title}">
{!--exp:ce_img:single src="{cottage_photos limit="1"}{url}{/cottage_photos}" crop="yes" width="225" height="200" allow_scale_larger="yes"--}
<strong class="title">{title}</strong>
</a>
<a href="#" title="Check availability (popup)"><i class="icon-calendar"></i> Check Availability</a><br>
<a href="{path='/accommodations/cottage-rentals/cottage'}/{entry_id}" title="View details for rental {title}"><i class="icon-zoom-in"></i> View Details</a><br>
<i class="icon-user"></i> {cottage_capacity}<br>
<i class="icon-home"></i> {cottage_bedroom_count}<br>
</div>
</li>
{if count == total_results}</ul>{/if}
{/exp:channel:entries}
{/if}
{!-- LIST VIEW -----------------------------------------------------------------}
{if "{embed:type}" == "list"}
{exp:channel:entries channel="cottage-rentals"
dynamic="no"
status="open"
paginate="bottom"
limit="25"
orderby="title"
sort="asc"
disable="categories|member_data"
}
{sn_pagination}
{if count == 1}
<!-- Sortable table props: see http://www.datatables.net/ -->
<table cellpadding="0" cellspacing="0" id="cottage-list-view">
<thead>
<tr>
<th>Gallery</th>
<th>Title</th>
<th>Capacity</th>
<th>Bedrooms</th>
<th>Preview</th>
<th>Details</th>
</tr>
</thead>
<tbody>
{/if}
<tr>
<td>
{!--cottage_photos limit="1"}
<a href="{url}" data-rel="{entry_id}" class="preview-modal">{exp:ce_img:single src="{url}" crop="yes" width="70" height="50" allow_scale_larger="yes" class="th"}</a>
{/cottage_photos--}
</td>
<td><a href="{path='accommodations/cottage-rentals/cottage'}/{entry_id}"><strong>{title}</strong></a></td>
<td>{cottage_capacity}</td>
<td>{cottage_bedroom_count}</td>
<td><a href="#" data-rel="{entry_id}" class="button preview-modal"><i class="icon-info-sign icon-large"></i> Preview</a></td>
<td><a href="{path='accommodations/cottage-rentals/cottage'}/{entry_id}" class="button"><i class="icon-zoom-in icon-large"></i> View Details</a></td>
</tr>
{if count == total_results}</tbody></table>{/if}
{/exp:channel:entries}
{/if}
{!-- COTTAGE DETAIL VIEW ---------------------------------------------------------}
{if "{embed:type}" == "detail"}
{exp:channel:entries channel="cottage-rentals"
dynamic="no"
status="open"
paginate="bottom"
limit="1"
orderby="title"
sort="asc"
disable="categories|member_data|pagination"
{if embed:cottage_id}entry_id="{embed:cottage_id}" {/if}
}
<p><a href="{path='accommodations/cottage-rentals'}"><i class="icon-chevron-left icon-small"></i> more cottage rentals</a></p>
<div class="row">
<div class="large-4 columns">
{!-- PHOTO GALLERY --}
<div id="cottage-photos">
{!--cottage_photos limit="21"}
{if count == '1'}
<a href="{url}" rel="group1" title="{desc}"><img src="{url}" width="100%" alt="{desc}" /></a>
<ul class="small-block-grid-4 large-block-grid-4">
{/if}
{if count > '1'}
<li>
<a href="{url}" rel="group1" class="cottage-thumb" title="{desc}">
{exp:ce_img:single src="{url}" crop="yes" width="160" height="122" allow_scale_larger="yes"}
</a>
</li>
{if count == total_results}
</ul>
{/if}
{/if}
{/cottage_photos--}
</div>
</div>
<div class="large-8 columns">
<div class="row">
<div class="large-7 columns">
<h3>{title}</h3>
{cottage_description}
<h4 class="orange">Features</h4>
{cottage_features}
<h4 class="orange">Rooms Description</h4>
{cottage_rooms_description}
</div>
<div class="large-5 columns">
<div class="cottage-info-box">
<p><strong>Bedrooms:</strong> {cottage_bedroom_count}<br />
<strong>Capacity:</strong> {cottage_capacity}</p>
</div>
<h4 class="orange">Rental Rates</h4>
{cottage_rental_rates}
</div>
</div>
{!-- MAP --}
{if cottage_display_map == "Yes"}
{if cottage_map_geocoded != ""}
<div style="clear:both; padding-top:10px;">
<h4>Location</h4>
{exp:gmap:init id="map" scrollwheel="false" style="width:100%;height:265px" latitude="{cottage_map_latitude}" longitude="{cottage_map_longitude}" map_type="google.maps.MapTypeId.ROADMAP"}
{exp:gmap:marker id="map" latitude="{cottage_map_latitude}" longitude="{cottage_map_longitude}" zoom="{cottage_map_zoom}" geocode="false"}{/exp:gmap:marker}
</div>
{/if}
{/if}
{!-- AVAILABILITY --}
{if cottage_rms_id != ""}
<div style="clear:both; padding-top:28px;">
<h4>Availability</h4>
<div id="cottage-availability">
<iframe scrolling="no" src="http://rms5.resortplanet.com/1459/calendar.php?unit={cottage_rms_id}" style="border-style:hidden; width:100%; height:770px;"></iframe>
</div>
</div>
{/if}
</div>
</div>
{if no_results}
<h3>Lakeside Chautauqua Cottage Listings</h3>
<p>Requested Cottage is no longer available or could not be found. Click here to return to <a href='{path="accommodations/cottage-rentals"}'>cottage rentals</a>
{/if}
{/exp:channel:entries}
{/if}