Author:
ashooner
Version:
.1
Release Date:
11 Jun 2010
Category:
Interface

Description

This is a basic breadcrumb utilizing just the default Symphony navigation datasource and $current-page-id parameter. It does not handle url parameters, but could be modified to do so pretty easily.

XSLT

View Raw
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output encoding="UTF-8" indent="yes" method="xml" />
<!-- 
Basic Symphony Breadcrumb
Version .1
Author: Andrew Shooner
This is a basic breadcrumb utilizing just the default Symphony navigation datasource and $current-page-id parameter.
It does not handle url parameters -->	

	<!-- paste apply-templates element below where you want the breadcrumb
			<xsl:apply-templates select="/data/navigation" mode='breadcrumb' />
-->
	
	
	<xsl:template match="/data/navigation" mode="breadcrumb">
		<ul class='breadcrumb'>
			<li><a href="/">Home</a></li>
			<xsl:apply-templates select="page[.//page[@id = $current-page-id]] | page[@id = $current-page-id]" mode="breadcrumb"/>	
		</ul>
	</xsl:template>

	<xsl:template match="page" mode="breadcrumb">
		<xsl:param name="base-url" select="'/'"/>
		<xsl:param name="this-page-url" select="concat($base-url, ./@handle, '/')" />
		<xsl:choose>
			<xsl:when test="@id = $current-page-id">
					<li><xsl:value-of select="name"/></li>
			</xsl:when>
			<xsl:otherwise>
					<li><a href="{$this-page-url}"><xsl:value-of select="name" /></a></li>
					<xsl:apply-templates select="page[.//page[@id = $current-page-id]] | page[@id = $current-page-id]" mode='breadcrumb'>
						<xsl:with-param name="base-url" select="$this-page-url" />
					</xsl:apply-templates>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

</xsl:stylesheet>

Discuss this XSLT Utility

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details