Skip to content

Instantly share code, notes, and snippets.

@iso100
Created June 17, 2013 12:12
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 iso100/5796428 to your computer and use it in GitHub Desktop.
Save iso100/5796428 to your computer and use it in GitHub Desktop.
Model template for detail layout.
{if {exp:stash:not_empty name="{segment_1}-color-styles" scope="site"}==0}
{exp:channel:entries
channel="overview"
disable="categories|member_data|pagination|trackbacks"
status="not Closed"
dynamic="no"
url_title="{segment_1}"
limit="1"
}
{exp:stash:set
name="{segment_1}-color-styles"
save="yes"
scope="site"
replace="no"
refresh="120"
}
/* source: detail */
{sn_color_css_overrides}
{/exp:stash:set}
{/exp:channel:entries}
{/if}
{exp:ce_cache:it driver="db" tags="detail" logged_out_only="yes"}
{!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
** This file sets up data variables for use
when rendering the detail template.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --}
{exp:channel:entries
channel="page_content"
disable="categories|member_data|pagination|trackbacks"
status="open"
limit="1"
require_entry="yes"
}
{if no_results}{redirect="404"}{/if}
{!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Redirect to URL if supplied
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --}
{if pg_redirect_url}{exp:hs_redirect method="script" location="{pg_redirect_url}"}{/if}
{!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Store the Coremetrics ID Content
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --}
{exp:stash:set name="coremetrics_page"}US:SMB:{exp:low_replace find="SPACE:SPACE" replace=":"}{exp:structure:titletrail reverse="yes" separator=":" site_name="no"}{/exp:low_replace}{/exp:stash:set}
{!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Store the Breadcrumb navigation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --}
{exp:stash:set name="breadcrumbs"}
{sn_breadcrumbs}
{/exp:stash:set}
{!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Store the Secondary Navigation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --}
{exp:stash:set name="secondary-nav"}
{sn_secondary_nav}
{/exp:stash:set}
{!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Store the Main Page Headlines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --}
{exp:stash:set name="intro" parse_tags="yes"}
<div class="intro">
{if pg_headline}<h1>{exp:low_widont}{pg_headline}{/exp:low_widont}</h1>{/if}
{if pg_intro_content}{exp:low_widont}{pg_intro_content}{/exp:low_widont}{/if}
</div>
{/exp:stash:set}
{!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Store the Blocks Content
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --}
{exp:stash:set name="blocks" parse="inward"}
{pg_blocks}
<div class="block {if block_image}size-{block_image_size}{/if}" id="block-{row_count}">
{if block_image}
<div class="img">
{if block_link}<a href="{block_link}">{/if}
{exp:ce_img:single src="{block_image}" width="{block_image_size}" max_width="{block_image_size}" quality="72" alt="{block_image:alt_text}"}
{if block_link}</a>{/if}
{if "{block_image:caption}"}<span class="caption">{exp:low_widont}{block_image:caption}{/exp:low_widont}</span>{/if}
</div>
{/if}
{if block_image}<div class="block-content">{/if}
{if block_headline}<h2>{if block_link}<a href="{block_link}">{/if}{exp:low_widont}{exp:low_replace regex="yes" find="^(.*)\|.*" replace="$1"}{block_headline}{/exp:low_replace}{/exp:low_widont}{if block_link}</a>{/if}</h2>{/if}
{if block_content}{exp:low_widont}{block_content}{/exp:low_widont}{/if}
{if block_image}</div>{/if}
</div>
{/pg_blocks}
{/exp:stash:set}
{!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Store the Image Galleries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --}
{pg_image_gallery}
{exp:switchee variable="{gal_cols}" parse="inward"}
{case value="5" default="Yes"}
{exp:stash:set name="gallery_{row_count}" type="snippet"}
<div class="gallery cols-5">
{gal_images}
{switch='<div class="row">||||'}
<div class="img{switch="|||| last"}">
{exp:ce_img:pair src="{url}" width="995"}
<a href="{url}" class="lightbox" title="{if caption}{caption}{/if}" data-group="set-{row_count}">
{/exp:ce_img:pair}
{exp:ce_img:single parse="inward" src="{url}" width="96" alt="{alt_text}"}
</a>
</div>
{switch="||||</div><!-- row -->"}
{!-- If there's an incomplete row, close the div --}
{if count==total_files}
{exp:will_hunting:solve_pair}
{$cols={gal_cols}}
{$tot_items={total_files}}
{$result=mod($tot_items,$cols)}
{if {$result}}</div><!-- row -->{/if}
{/exp:will_hunting:solve_pair}
{/if}
{/gal_images}
</div>
{/exp:stash:set}
{/case}
{case value="4"}
{exp:stash:set name="gallery_{row_count}" type="snippet"}
<div class="gallery cols-4">
{gal_images}
{switch='<div class="row">|||'}
<div class="img{switch="||| last"}">
{exp:ce_img:pair src="{url}" width="995"}
<a href="{url}" class="lightbox" title="{if caption}{caption}{/if}" data-group="set-{row_count}">
{/exp:ce_img:pair}
{exp:ce_img:single parse="inward" src="{url}" width="135" alt="{alt_text}"}
</a>
</div>
{switch="|||</div><!-- row -->"}
{!-- If there's an incomplete row, close the div --}
{if count==total_files}
{exp:will_hunting:solve_pair}
{$cols={gal_cols}}
{$tot_items={total_files}}
{$result=mod($tot_items,$cols)}
{if {$result}}</div><!-- row -->{/if}
{/exp:will_hunting:solve_pair}
{/if}
{/gal_images}
</div>
{/exp:stash:set}
{/case}
{case value="3"}
{exp:stash:set name="gallery_{row_count}" type="snippet"}
<div class="gallery cols-3">
{gal_images}
{switch='<div class="row">||'}
<div class="img{switch="|| last"}">
{exp:ce_img:pair src="{url}" width="995"}
<a href="{url}" class="lightbox" title="{if caption}{caption}{/if}" data-group="set-{row_count}">
{/exp:ce_img:pair}
{exp:ce_img:single parse="inward" src="{url}" width="174" alt="{alt_text}"}
</a>
</div>
{switch="||</div><!-- row -->"}
{!-- If there's an incomplete row, close the div --}
{if count==total_files}
{exp:will_hunting:solve_pair}
{$cols={gal_cols}}
{$tot_items={total_files}}
{$result=mod($tot_items,$cols)}
{if {$result}}</div><!-- row -->{/if}
{/exp:will_hunting:solve_pair}
{/if}
{/gal_images}
</div>
{/exp:stash:set}
{/case}
{case value="2"}
{exp:stash:set name="gallery_{row_count}" type="snippet"}
<div class="gallery cols-2">
{gal_images}
{switch='<div class="row">|'}
<div class="img{switch="| last"}">
{exp:ce_img:pair src="{url}" width="995"}
<a href="{url}" class="lightbox" title="{if caption}{caption}{/if}" data-group="set-{row_count}">
{/exp:ce_img:pair}
{exp:ce_img:single parse="inward" src="{url}" width="252" alt="{alt_text}"}
</a>
</div>
{switch="|</div><!-- row -->"}
{!-- If there's an incomplete row, close the div --}
{if count==total_files}
{exp:will_hunting:solve_pair}
{$cols={gal_cols}}
{$tot_items={total_files}}
{$result=mod($tot_items,$cols)}
{if {$result}}</div><!-- row -->{/if}
{/exp:will_hunting:solve_pair}
{/if}
{/gal_images}
</div>
{/exp:stash:set}
{/case}
{/exp:switchee}
{/pg_image_gallery}
{!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Store the Main Page Content
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --}
{exp:stash:set name="page-content"}{pg_content}{/exp:stash:set}
{!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Store the Contact Info Content
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --}
{exp:stash:set name="contact" parse_tags="yes"}
{pg_contact}
{sn_contact}
{/pg_contact}
{/exp:stash:set}
{!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Store the Promo Content
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --}
{exp:stash:set name="promo"}
{exp:playa:children field="pg_promo" limit="2"}
<div class="promo module">
{if pr_image}
{if pr_image_link}<a href="{pr_image_link}">{/if}
{exp:ce_img:single src="{pr_image}" width="215" max_width="215" quality="72" class="rounded" alt="{pr_image:alt_text}"}
{if pr_image_link}</a>{/if}
{/if}
{if '{is_bwf_preview}' != ''}<p>Promo images not currently previewable</p>{/if}
{if pr_heading}<h4>{pr_heading}</h4>{/if}
{if pr_content}{pr_content}{/if}
</div>
{/exp:playa:children}
{/exp:stash:set}
{!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Store the FAQ Content
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --}
{exp:stash:set name="faq-has-items"}{exp:playa:total_children field="pg_faqs"}{/exp:stash:set}
{exp:stash:set name="faq"}
{exp:playa:children field="pg_faqs"}
<dt><a href="javascript:void(0);" class="hidden"><span></span>{exp:low_widont}{faq_question}{/exp:low_widont}</a></dt>
<dd>{exp:low_widont}{faq_answer}{/exp:low_widont}</dd>
{/exp:playa:children}
{/exp:stash:set}
{/exp:channel:entries}{!-- END OF CHANNEL ENTRIES TAG --}
{!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Call the Detail Layout
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --}
{embed="_layouts/_detail"}
{/exp:ce_cache:it}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment