Created
February 10, 2012 16:23
-
-
Save croxton/1790604 to your computer and use it in GitHub Desktop.
Switchee devot:ee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{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