Displaying system-page-title with Velocity
Hello!
I've been using XSLT, but recently came across an issue better
solved with another language, so it made sense to learn Velocity.
The problem is that we typically pull the page title for the
DEFAULT using <xsl:value-of
select="system-page-title"/>
. I've not been able to
figure out it's equivalent in Velocity. Is it just not possible
when a index block is plugged into the DEFAULT section?
Here's the beginning of what we use in XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:include href="site://WCMS-Commons/format-date"/>
<xsl:template match="system-data-structure">
<xsl:param name="titleDate" select="''"/>
<div id="content" role="main">
<h2>
<system-page-title/>
</h2>
Here's what I've tried in Velocity (along with many others that
I can't remember):
#set($title = $_XPathTool.selectNodes($contentRoot, '//calling-page')) ##doesn't work because there is no calling page for RSS blocks
#set($title = $_XPathTool.selectNodes($contentRoot, '//system-page-title'))
#set($title = $_XPathTool.selectSingleNode($contentRoot, '//page-title'))
#set($title = $_XPathTool.selectSingleNode($contentRoot, '//page/system-page-title'))
Any suggestions?
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ryan Griffith on 09 Feb, 2015 04:16 PM
Hi,
If you are running Cascade Server 7.10.1 or newer, you can use the predefined
$currentPage
Velocity variable which will give you access to the calling page's information. For example:Note: the
$currentPage
variable uses the Cascade API, which differs from the XML data you are accustomed to when working with Index Blocks and XSLT Formats or the Velocity XPath Tool. The API is also used by the Velocity Locator Tool.Please let me know if you have any questions.
Thanks!
2 Posted by S. Croniser on 09 Feb, 2015 04:25 PM
Thanks for the fast reply. This solved my issue - I knew it had to be something simple!
3 Posted by Ryan Griffith on 09 Feb, 2015 04:29 PM
Not a problem at all, glad to hear you were able to use the
$currentPage
variable to meet your needs.I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.
Have a great day!
Ryan Griffith closed this discussion on 09 Feb, 2015 04:29 PM.