tag:help-archives.hannonhill.com,2010-02-09:/discussions/velocity-formats/178-display-system-page-title-of-current-pageCascade CMS: Discussion 2012-04-05T17:36:14Ztag:help-archives.hannonhill.com,2010-02-09:Comment/150445352012-04-05T14:40:12Z2012-04-05T14:40:12ZDisplay system page title of current page<div><p>Hi pinaydriver --</p>
<p>Where are you looking to output this information? There are a
few different methods depending how how you're looking to do
it.</p>
<p>There are <a href=
"http://www.hannonhill.com/kb/Available-System-Tags/index.html">Metadata
Tags</a> that can be used in Templates, Formats, and WYSIWYGs.</p>
<p>There are some things to note in each case though.</p>
<ul>
<li>
<p>Template: The tags cannot be used INSIDE of an XHTML tag
attribute.</p>
</li>
<li>
<p>Formats: If you want to use one of the
<code><system-page-></code> tags you'll want to be 100% sure
that there is only 1 <code>system-page</code> XML node to choose
from. So depending on what Block you're paring it with you'll need
to make sure that is handled correctly.</p>
</li>
<li>
<p>WYSIWYG: You'll want to use the brace notation to the right of
the tags and type it directly into the WYSIWYG and not the HTML
source view.</p>
</li>
</ul>
<p>Check out <a href=
"http://help.hannonhill.com/discussions/how-do-i/897-current-page-url#comment_14987917">
this comment</a> as well for more information about how to get the
current page's information into a Block.</p>
<p>Let me know if there's anything else!<br>
Thanks.</p></div>Charlie Holdertag:help-archives.hannonhill.com,2010-02-09:Comment/150445352012-04-05T14:57:56Z2012-04-05T14:58:41ZDisplay system page title of current page<div><p>Hi Charlie,</p>
<p>Currently working on site navigation. I want to show the title
of the page I am currently in including its children nodes. I am
running a script initially to show the current folder with page
title but not working.</p>
<pre>
<code>#set ($folders = $_XPathTool.selectNodes($contentRoot, "/system-index-block/system-folder[system-page [@current] ] " ) )
#set ($currentfolder = $folders.getChild("name").value)
folder name - $currentfolder <br />
#set ($currentpage = $folders.getChild("system-page").getChild("title").value )
page title - $title</code>
</pre></div>pinaydivertag:help-archives.hannonhill.com,2010-02-09:Comment/150445352012-04-05T15:07:25Z2012-04-05T15:07:25ZDisplay system page title of current page<div><p>There are a few things wrong with this script in order to pull
the current data, but you're very close.</p>
<p>First, the <code>.selectNodes()</code> method will select
multiple nodes (if available) that meet the criteria in the XPath
statement. It will return a list and not just a single XML element
reference. So currently your <code>$folders</code> variable is a
list and not a reference to the folder that contains the current
page. One of the items in the list is that folder, but you can't
just reference the variable. For this particular case I would
recommend using the <code>.selectSingleNode()</code> method
instead. It looks like you just want to select the 1 folder and not
(potentially) a bunch of folders.</p>
<p>Second, your XPath statement might be a little off. The
conditions that you've supplied are looking good, but I'm not 100%
on the spaces. When you apply a condition, the set of square
brackets, you'll want to bud those right up against the XML node
you want the condition to apply to. So change your XPath to be this
to be safe:</p>
<pre>
<code>"/system-index-block/system-folder[system-page[@current]]"</code>
</pre>
<p>Third, when pulling the Title of a Page or Folder, it's
important to realize that they could have typed ANYTHING in for
that text field. When trying to display data from a text field,
you'll want to escape it and make sure that exactly what they typed
is rendered. If they typed a greater than sign, we don't want it to
accidentally be interpreted from the browser processor as HTML
code. Depending on what version of Cascade you're running I would
use <a href=
"http://www.hannonhill.com/kb/Script-Formats/index.html#escape-tool">
$_EscapeTool.xml()</a> if you're using Cascade 6.10+ or <a href=
"http://www.hannonhill.com/kb/Script-Formats/index.html#serializer-tool">
$_SerializerTool.serialize()</a> for all lesser releases.</p>
<p>Hope this helps. Let me know!</p></div>Charlie Holdertag:help-archives.hannonhill.com,2010-02-09:Comment/150445352012-04-05T17:18:39Z2012-04-05T17:18:39ZDisplay system page title of current page<div><p>Thank you for your help. You may now close this discussion.</p></div>pinaydivertag:help-archives.hannonhill.com,2010-02-09:Comment/150445352012-04-05T17:36:12Z2012-04-05T17:36:12ZDisplay system page title of current page<div><p>No problem. If anything else comes up related to this feel free
to just reopen!</p></div>Charlie Holder