Displaying the parent folder's path of each system-page in an index block (folder type)
Hello, what's the best way to display the URL of a page, without the "index.php" at the end?
For example:
https://www.union.edu/academic/majors-minors/computational-methods/
Instead of:
https://www.union.edu/academic/majors-minors/computational-methods/...
In the past, we've displayed the parent folder's path using
$currentPage.parentFolder.path
but in this case, the
pages are being generated from a folder type index block using a
foreach loop:
#set ( $block = $_XPathTool.selectNodes($contentRoot, $xPath) )
#foreach ( $page in $block )
#set ( $path = $page.getChild("path").value )
<url>
<loc>https://www.union.edu${_EscapeTool.xml($path)}.php</loc>
</url>
#end
and parentFolder
isn't a property available to the
$page
variable:
Properties:
- value: String
- textNormalize: String
- text: String
- parentElement: Element
- getDescendants(Filter): Iterator
- descendants: Iterator
- getChildText(String): String
- getChildText(StringNamespace): String
- getChildTextNormalize(StringNamespace): String
- getChildTextNormalize(String): String
- getDescendants(Filter): Iterator
- descendants: Iterator
- additionalNamespaces: List
- name: String
- getNamespace(String): Namespace
- namespace: Namespace
- textTrim: String
- getChildTextTrim(StringNamespace): String
- getChildTextTrim(String): String
- class: Class
- getAttribute(StringNamespace): Attribute
- getAttribute(String): Attribute
- qualifiedName: String
- children: List
- getChildren(String): List
- getChildren(StringNamespace): List
- getChild(String): Element
- getChild(StringNamespace): Element
- namespaceURI: String
- parent: Parent
- contentSize: int
- rootElement: boolean
- parent: Parent
- getContent(Filter): List
- content: List
- getContent(int): Content
- getAttributeValue(StringNamespace): String
- getAttributeValue(String): String
- getAttributeValue(StringString): String
- getAttributeValue(StringNamespaceString): String
- getContent(Filter): List
- getContent(int): Content
- content: List
- contentSize: int
- namespacePrefix: String
- document: Document
- attributes: List
- document: Document
- isAncestor(Element): boolean
Any suggestions would be much appreciated.
Erik
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 Wing Ming Chan on 22 Jul, 2016 07:44 PM
Erik,
Will you consider simple string manipulation like the following?
Wing
2 Posted by espanae on 22 Jul, 2016 08:36 PM
Yes, I thought about using string manipulation but didn't know how. Where did you learn about the
endsWith()
method?This code seems to do the trick so I should be all set.
Thanks,
Erik
3 Posted by Wing Ming Chan on 22 Jul, 2016 08:59 PM
See my API documentation:
http://www.upstate.edu/cascade-admin/formats/velocity/api-documenta...
http://www.upstate.edu/cascade-admin/formats/velocity/api-documenta...
my tutorial:
http://www.upstate.edu/cascade-admin/formats/velocity/courses/intro...
Also see http://www.upstate.edu/cascade-admin/formats/velocity/api-documenta... for the information of
org.jdom.Element
(the superset of what you see when you use$_PropertyTool( $page )
).Wing