I’m working on a “real property” site that does the following:
Check the page URL, if segment 2 is empty, show the overview page, if not, show the detail page.
The Overview page shows all the buildings ( title + thumb ) the detail page shows all the info about 1 building ( title, gallery, etc.. )
This is roughly the code I’m using:
{if segment_2 == ""}
{exp:channel:entries channel="gebouwen"}
<a href="http://{lang_url}gebouwen/{url_title}">{title}</a>
{exp:ce_img:single src="{preview_image}" max_width="167" max_height="218" crop="yes|center,top" filter="sharpen,130"}
{/exp:channel:entries}
{if:else}
{exp:channel:entries channel="gebouwen"}
{title}
{gallery}
{exp:ce_img:pair src="{image}" max_width="927" max_height="345" crop="yes|center,center" filter="sharpen,100"}
{made}
{/exp:ce_img:pair}
{/gallery}
{/exp:channel:entries}
{/if}
Now, this works, no problem, but I noticed the page loads very slowly.
upon further investigation I discovered that when showing the overview page, ( and segment 2 = empty )
EE still parses the second part in my if-statement and loads ALL the images in the galleries of ALL my entries. Resulting in a 11MB page. ( no wonder it took a while to load )
So, why is this part being parsed:
{gallery}
{exp:ce_img:pair src="{image}" max_width="927" max_height="345" crop="yes|center,center" filter="sharpen,100"}
{made}
{/exp:ce_img:pair}
{/gallery}when the segment_2 == “” ?