Useful Functions and Variables
There are a whole raft of useful functions contained in the following file
/ewcommon/xsl/tools/functions.xsl
A web developer using eonicweb should become familiar with these variables and functions.
Page and Navigation Variables
$page - returns the full page Xml
$pageId - returns the page id of the current page
$menu - returns the menu root
$cart - returns the current cart xml
$cartPage - returns the current cart process stage
$adminMode - returns true if the user is logged in on admin
$currentPage - Returns the menuItem node of the current page
$sectionPage - Returns the menuItem node of the first level that the contains the current page
$subSectionPage - Returns the menuItem node of the second level that the contains the current page
$subSubSectionPage - Returns the menuItem node of the third level that the contains the current page
$href - returns the full URL of the current page or article
Date Variables
$today - Todays date
$currentYear
$currentMonth - current month numberic
$curretnDay - current day of the month
$calendarMonth - Month specficied in a calendar control on the current page
Other Variables
$illeagalURLString - list of characters that cannot be used in URL's
$illeagalReplaceString - returns "----" to be used in URL's
$userAgent - Returns the users browser and version details
$browserVersion - Returns the current browser version
$paramDelimiter - Returns & in adminMode and ? when live. This is used in URL's which have existing querystrings when in admin but not live.
$currency - returns the current currency, default = GBP
$currencySymbol - Returns the current currency symbol, default = £
$querySymbol - Same as paramDelimiter
$descriptiveContentURLs - TBC
$siteURL - URL of the current site not secured
$siteName - Returns the name of the site from config settings
$cartSiteURL - returns the secure URL of the current site
$artId - returns the id of the current article shown
$appPath - returns the file path on the server of the current application
$alphabet - returns 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
$alphabetLo - returns 'abcdefghijklmnopqrstuvwxyz'
Javascript Templates
Use the following templates to load in specific javascript files for your site.
<!-- overidable template to pull in site specific files -->
<xsl:template match="Page" mode="siteJs"></xsl:template>
<!-- overide template for site specific footer js -->
<xsl:template match="Page" mode="siteFooterJs"></xsl:template>
<!-- overidable template to pull in page specific files -->
<xsl:template match="Page" mode="pageJs"></xsl:template>
String Functions
this returns a string with any illegal javascript characters escaped.
<xsl:call-template name="escape-js">
<xsl:with-param name="string">
<xsl:value-of select="Value to Escape"/>
</xsl:with-param>
</xsl:call-template>