I’m trying to get a reference to a page in velocity.
The preferred way would be to have document picker, i.e. pick the document from a control and get passed a reference into a velocity variable.
But I’d also fine if I could paste the full URL of an xwiki page into my form and get the reference from this.
I searched throw through the docs and found Document Picker Macro and references to a StandardURLResourceReferenceResolver.
But I can’t get both to work.
to be honest I’m feeling kind of stupid now. I was so fixated on information getting POSTed in the Document Picker macro and was desperately searching for this $thisIsWhatYouWant=$someLocationPickerMagic.doMagic() line in velocity that I completely missed the GET- parameters.
So I can get what I want for now, although I may reach out to you for help on customizing the picker.
I now have a working example of what I want to achieve (see below). Yet I wonder if and how I should differentiate between nested pages and terminal pages. Currently I always append “.WebHome” to the reference to get the page. Do I need to treat terminal pages “special”?
The way you configured the location picker it can select only nested pages. $myspaceReference is a space reference. The clean way to get the reference to the corresponding nested page is:
It will resolve nested pages only, because the picker only allows you to select nested pages (terminal pages are not shown in the tree with your current configuration). The picker can be configured to show terminal pages also, but getting the reference of the selected terminal page is not that straightforward. Do you need to work with terminal pages?