Skip to content

Instantly share code, notes, and snippets.

@litzinger
Created March 16, 2012 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save litzinger/2050859 to your computer and use it in GitHub Desktop.
Save litzinger/2050859 to your computer and use it in GitHub Desktop.
Simple EE template example
{!-- Redirect to the registration page if logged out and trying to access the account page --}
{if segment_1 == "account" AND logged_out == TRUE}
{redirect="account/register-full"}
{/if}
{exp:channel:entries status="{global:default_status}" disable="{global:disabled_params}"}
{snippet:_header}
<div class="main-wrapper">
<div class="content" id="content-anchor">
{snippet:_breadcrumbs}
{embed="blocks/_page_heading" title="{title}" url_title="{url_title}" subtitle="{page_subtitle}" entry_id="{entry_id}"}
{if page_hero_image}
{embed="blocks/_hero_image" channel_name="pages" field_name="page_hero_image" total_results="{page_hero_image}{if count < '2'}{absolute_results}{/if}{/page_hero_image}"}
{/if}
<div class="column-group">
<div class="column sidebar">
{page_sidebar_blocks}
{template embed="y"}
{/page_sidebar_blocks}
{embed="global/_mason_blocks_sidebar" entry_id="{entry_id}" field_name="page_mason_blocks"}
</div>
<div class="column main">
{page_blocks}
{if "{location}" == "before"}
{template embed="y"}
{/if}
{/page_blocks}
{if page_body}
<div class="wysiwyg">
{page_body}
</div>
{/if}
{page_blocks}
{if "{location}" == "after"}
{template embed="y"}
{/if}
{/page_blocks}
{embed="global/_mason_blocks_main" entry_id="{entry_id}" field_name="page_mason_blocks"}
</div>
</div>
</div>
</div>
{snippet:_footer}
{/exp:channel:entries}
{!-- Don't like using an entries tag just to get the entry_id for the header, but don't have
much of a choice here. Disabling all custom fields, categories etc, so query should be small --}
{exp:channel:entries
channel="solutions"
status="{global:default_status}"
disable="{global:disabled_params_all}"
limit="1"
{global:cache_tag}}
{!-- if for some reason no entry is found we still need our header included. --}
{!-- {if no_results}{snippet:_header}{/if} --}
{!-- if an entry is found, this header will be used, but ignored if no_results is true above. --}
{snippet:_header}
{/exp:channel:entries}
<div class="main-wrapper">
<div class="content" id="content-anchor">
{exp:channel:entries
channel="pages"
entry_id="48"
dynamic="no"
disable="{global:disabled_params}"
status="{global:default_status}"
limit="1"
{global:cache_tag}}
{snippet:_breadcrumbs}
<h1 class="main-heading">{title}</h1>
{/exp:channel:entries}
{exp:channel:entries
channel="solutions"
status="{global:default_status}"
disable="{global:disabled_params}"
limit="1"
{global:cache_tag}}
<div class="column-group">
<div class="column sidebar">
{embed="blocks/sidebar_nav"}
{embed="blocks/_detail_related_news" channel_name="solutions" field_name="solutions_rel_news" total_results="{solutions_rel_news}{if count < '2'}{absolute_results}{/if}{/solutions_rel_news}"}
</div>
<div class="column main">
<h1 class="module-heading">{title}</h1>
<div class="column-group">
<div class="column double">
<div class="wysiwyg">
{solution_body}
</div>
{solution_rel_featured_video}
<div class="video_container">
<a href="{video_file_upload:url}" style="display:block;width:410px;height:294px" id="player"></a>
</div>
{exp:hits:count_hits_image entry_id="{entry_id}"}
<div class="wysiwyg">
<p>
<strong>
{exp:hits:item_stats entry_id="{entry_id}"}
{hits:year}
{if "{hits:year}" != "1"}
{lang:view_plural}
{if:else}
{lang:view_singular}
{/if}
{/exp:hits:item_stats}
</strong>
</p>
{exp:likee:like entry_id="{entry_id}" like_text="{lang:video_like_text}"}
<p class="likee_links"><strong>{like_count}
<span class="people_or_person">
{if "{exp:eehive_hacksaw}{like_count}{/exp:eehive_hacksaw}" == "1"}
{lang:person}
{if:else}
{lang:people}
{/if}
</span>
{lang:found_this_video_helpful}
{exp:likee_has_voted entry_id="{entry_id}"}
{if has_voted == "yes"}
{if:else}
<span class="likee_text">- {like}</span>
{/if}
{/exp:likee_has_voted}</strong></p>
{/exp:likee:like}
</div>
{/solution_rel_featured_video}
{solution_rel_videos}
{if count == "1"}
<div class="border-bottom">
<h2 class="module-heading alt">{lang:related_videos}</h2>
</div>
{/if}
{switch="<div class='column-group'>|"}
<div class="column half">
{if video_thumbnail_image:server_path}
<a href="{page_url}">{exp:ce_img:pair src="{video_thumbnail_image:server_path}" alt="{title}" width="48"}</a>
{/if}
<h3 class="section-heading alt">{title}</h5>
<p>{lang:time} {video_length}</p>
<p><a class="arrow" href="{page_url}">{lang:watch_video}</a></p>
</div>
{if count == absolute_results}
</div>
{if:else}
{switch="|</div>"}
{/if}
{/solution_rel_videos}
</div>
<div class="column single">
{if solution_rel_featured_downloads}
<div class="featured-item">
<div class="border-bottom">
<h3 class="module-heading alt">{lang:downloads}</h3>
</div>
{solution_rel_featured_downloads limit="3"}
{embed="blocks/_download_file"
entry_id="{entry_id}"
field_name="literature_pdfs"
login_required="yes"
tos_required="literature"
title="{title}"
display="solutions"}
{/solution_rel_featured_downloads}
</div>
{/if}
{if solution_rel_featured_casestudies}
<div class="featured-item">
<div class="border-bottom">
<h3 class="module-heading alt">{lang:featured_case_studies}</h3>
</div>
{solution_rel_featured_casestudies limit="3"}
<div class="main">
<div class="wysiwyg">
{study_short_desc}
</div>
<p><a class="arrow" href="{page_url}">{lang:learn_more_about_this_case_study}</a></p>
</div>
{/solution_rel_featured_casestudies}
</div>
{/if}
{if solution_rel_featured_papers}
<div class="featured-item">
<div class="border-bottom">
<h3 class="module-heading alt">{lang:white_papers}</h3>
</div>
{solution_rel_featured_papers limit="3"}
{embed="blocks/_download_file"
entry_id="{entry_id}"
field_name="literature_pdfs"
login_required="yes"
tos_required="literature"
title="{title}"
display="solutions"}
{/solution_rel_featured_papers}
</div>
{/if}
</div>
</div>
</div>
</div>
{/exp:channel:entries}
</div>
</div>
{snippet:_footer}
{exp:channel:entries
dynamic="no"
channel="states"
status="open"
disable="{global:disabled_params}"
url_title="{segment_2}"
{global:cache_tag}}
{!-- Make sure a valid & existing state is requested, if not, go back to the map --}
{if no_results}
{redirect="/states/"}
{/if}
{snippet:global_header}
{embed="global/_state-navigation"}
<h1>{if state_header_title}{state_header_title}{if:else}{title}{/if}</h1>
<a href="{state_requirement_pdf}">State Requirement PDF</a>
{exp:imgsizer:size src="{state_banner_image}" width="800" height="100"}
<img src="{sized}" width="{width}" height="{height}" />
{/exp:imgsizer:size}
{if state_photograph_credit}
{state_photograph_credit}
{/if}
{state_body}
<h3>Licensing</h3>
<ul>
{categories show="52|53|54" style="linear"}
<li>
{!-- Using full URL b/c {path=""} tries to render differently inside a {categories} tag pair --}
<a href="{site_url}{segment_1}/{url_title}/{category_url_title}">{category_name}</a>
</li>
{/categories}
</ul>
<h3>Continuing Education</h3>
<ul>
{categories show="55|56" style="linear"}
<li>
<a href="{site_url}{segment_1}/{url_title}/{category_url_title}">{category_name}</a>
</li>
{/categories}
</ul>
{snippet:global_footer}
{/exp:channel:entries}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment