Last active
August 29, 2015 14:08
-
-
Save andy-s-clark/66551f14a300f3a97d84 to your computer and use it in GitHub Desktop.
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
<!--- Option A ---> | |
<cfloop index="trailItemIndex" from="0" to="#trailItemsCount - 1#"> | |
<cfset trailItem = trailItems.get(trailItemIndex) /> | |
<!--- Only list the first and last category, | |
with an ellipsis in the middle if more than two ---> | |
<cfif trailItemIndex GT 0> | |
<span class="breadcrumb-delimiter">></span> | |
</cfif> | |
<cfif (trailItemIndex EQ 0) OR (trailItemIndex EQ (trailItemsCount-1))> | |
<cfset trailItemLink = request.utility.makeLink(link = "/" & | |
((NOT IsNull(trailItem.getLink()) AND Len(trailItem.getLink()) GT 0) | |
? trailItem.getLink() | |
: trailItem.getSlug() & "/c" & trailItem.getCategoryId()) | |
) /> | |
<a href="#trailItemLink#">#trailItems.get(trailItemIndex).getCategoryName()#</a> | |
<cfelseif trailItemIndex EQ 1> | |
… | |
<cfset trailItemIndex = trailItemsCount-2 /> | |
</cfif> | |
</cfloop> | |
<!--- Option B ---> | |
<cfif trailItemsCount GT 0> | |
<cfset trailItemLink = request.utility.makeLink(link = "/" & | |
((NOT IsNull(trailItems.get(0).getLink()) AND Len(trailItems.get(0).getLink()) GT 0) | |
? trailItems.get(0).getLink() | |
: trailItems.get(0).getSlug() & "/c" & trailItems.get(0).getCategoryId()) | |
) /> | |
<a href="#trailItemLink#">#trailItems.get(0).getCategoryName()#</a> | |
</cfif> | |
<cfif trailItemsCount GT 2> | |
<span class="breadcrumb-delimiter">></span> … | |
</cfif> | |
<cfif trailItemsCount GT 1> | |
<cfset trailItemLink = request.utility.makeLink(link = "/" & | |
((NOT IsNull(trailItems.get(trailItemsCount-1).getLink()) AND Len(trailItems.get(trailItemsCount-1).getLink()) GT 0) | |
? trailItems.get(trailItemsCount-1).getLink() | |
: trailItems.get(trailItemsCount-1).getSlug() & "/c" & trailItems.get(trailItemsCount-1).getCategoryId()) | |
) /> | |
<span class="breadcrumb-delimiter">></span> | |
<a href="#trailItemLink#">#trailItems.get(trailItemsCount-1).getCategoryName()#</a> | |
</cfif> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment