Velocity Array Examples
Hey Guys,
I can't seem to find any working array examples for Velocity. I basically want to take the breadcrumb code from github (https://github.com/hannonhill/Velocity-Cookbook/tree/master/Breadcr...) and reverse the order for our title pages. My thought was to store what's being printed in an array and reverse the array, but it looks like my syntax is a bit off. I can't really find any good examples of declaring and adding to arrays. Each one I find is different.
Joe
PS- if there is a better way to do this, I'm all ears. I don't know Velocity too well.
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 10 Feb, 2014 05:02 PM
Hi Joe,
To confirm, are you looking to simply reverse the order the breadcrumbs are displayed? For example, the current page would be listed first and the Site's homepage would be listed last?
If so, you can use some recursion along with the
Element.getParent()
to traverse up the structure, starting with the current page. The following may be a good starting point:Please let me know if you have any questions.
Thanks!
2 Posted by joseph.casabona on 10 Feb, 2014 09:44 PM
Ryan,
Fantastic- that worked. Thanks so much!
Joe
3 Posted by Ryan Griffith on 11 Feb, 2014 01:03 PM
Not a problem at all, Joe. I am glad to hear that format did the trick.
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 11 Feb, 2014 01:03 PM.