stephenjbell

Simple breadcrumb - dotCMS

Oct 31st, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.92 KB | None | 0 0
  1. #set($thisUrl = $request.getAttribute("javax.servlet.forward.request_uri"))
  2. #set($thisUrl = $thisUrl.replaceAll("index\.html$","")) ## Ignore the index.html for the purposes of the crumbtrail
  3.  
  4.  
  5. #if($thisUrl.matches("^.*\/[^\/]+$")) ## If there is something after the last slash
  6.     #set($isSubPage = true)
  7. #else
  8.     #set($isSubPage = false)
  9. #end
  10.  
  11. #set($thisUrl = $thisUrl.replaceAll("[^\/]*$","")) ## Strip off filename
  12.  
  13. #set($listFromUrl = $thisUrl.split("/") )
  14. #set($listSize = $listFromUrl.size())
  15.  
  16. <ul class="breadcrumb">
  17.     <li><a href="/">OC</a><span class="crumbsep">&rsaquo;</span> </li>
  18.     #set($currentUrl = "")
  19.     #foreach ($piece in $listFromUrl)
  20.       #if($piece != "")
  21.         #set($currentUrl = $currentUrl + "/" + $piece)
  22.             #set($currentFolder= $folderAPI.findCurrentFolder($currentUrl,$host))
  23.             <li><a href="$!{currentUrl}">$!{currentFolder.title}</a><span class="crumbsep">&rsaquo;</span> </li>
  24.       #end
  25.     #end
  26. </ul>
Advertisement
Add Comment
Please, Sign In to add comment