Skip to content

Instantly share code, notes, and snippets.

@croxton
Created February 10, 2012 16:23
Show Gist options
  • Save croxton/1790604 to your computer and use it in GitHub Desktop.
Save croxton/1790604 to your computer and use it in GitHub Desktop.
Switchee devot:ee
{exp:switchee variable="{segment_1}/{segment_2}/{segment_3}" parse="inward"}
{case value = "//"}
{!-- s1, s2 and s3 are empty - Show home page --}
{embed="site/_home"}
{/case}
{case value="#^products/\S+/\S+$#"}
{!-- s1 is 'products', s2 and s3 are not empty - Show single products --}
{embed="site/_product"}
{/case}
{case value="#^products/\S+/$#"}
{!-- s1 is 'products', s2 is not empty, s3 is empty - Show product cat --}
{embed="site/_product_cat" layout="single_cat"}
{/case}
{case value="#^products//$#"}
{!-- s1 is 'products', s2 and s3 are empty - Show all product cats --}
{embed="site/_product_cat" layout="all_cats"}
{/case}
{case default="yes"}
{!-- Show static page --}
{embed="site/_page"}
{/case}
{/exp:switchee}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment