I am attempting to utilize the example code from the links I mentioned earlier 
but update it to reflect that the parent-child relationship is deprecated under 
the new Nested Pages concept. This is the code I have so far:

{{velocity}}
#set($query="where doc.space='$doc.getSpace()'")
#set($results = false)
#set($results = $xwiki.searchDocuments($query, 10, 0))
#set($first = true)
#foreach($docname in $results)
#set($rdoc = $xwiki.getDocument($docname).getTranslatedDocument())
[[$rdoc.getDisplayTitle()>>$rdoc.fullName]]
#end
{{/velocity}}

It works to a point but the results look like this:

Test Child 2 <http://localhost:8081/xwiki/bin/view/Test/Test+Child+2>
Test Child 6 <http://localhost:8081/xwiki/bin/view/Test/Test+Child+6>
Test <http://localhost:8081/xwiki/bin/view/Test/>
Test Child 1 <http://localhost:8081/xwiki/bin/view/Test/Test+Child+1>
Test Child 3 <http://localhost:8081/xwiki/bin/view/Test/Test+Child+3>
Test Child 5 <http://localhost:8081/xwiki/bin/view/Test/Test+Child+5>
Test Child 0 <http://localhost:8081/xwiki/bin/view/Test/Test+Child+0>
Test Child 4 <http://localhost:8081/xwiki/bin/view/Test/Test+Child+4>

The ‘Test’ page listed represents the page containing the code which I would 
consider the parent or container page and the nested pages are in no 
discernible order. These nested pages were all generated with a script (if 
helpful I can provide the code) using an array of names and a foreach loop, so 
I would expect that they were created in the order the names were provided in 
the array which was ascending order. Also I notice that alphanumeric sort order 
seems to be the default in Xwiki so I am a little surprised by these results.

Any helpful advice you can provide to remove the container page and sort the 
results would be appreciated.

Regards,

Jesse Bright


> On Mar 20, 2016, at 5:26 PM, Jesse Bright <je...@abrightfamily.com> wrote:
> 
> Never mind, I found these after I posted:
> 
> http://platform.xwiki.org/xwiki/bin/view/DevGuide/APIGuide#HCreateanewDocument
> http://extensions.xwiki.org/xwiki/bin/view/Extension/Immediate+Children+Pages
> 
> I had search for this before but without including 'velocity' in the search I 
> was only getting the more basic instructions. 
> 
> Regards,
> 
> Jesse
> 
>> On Mar 19, 2016, at 1:55 PM, Personal <je...@abrightfamily.com> wrote:
>> 
>> I am creating a knowledge base for a local municipal code which follows a 
>> typical book hierarchy. I plan on using nested pages to create a pages 
>> hierarchy for navigating and searching the code text at different levels. 
>> For example each end page would have a space path like so:
>> 
>> Title 19.Part 2.Chapter 4.Section 100
>> Title 19.Part 2.Chapter 4.Section 200
>> etc.
>> 
>> Currently I am using a Velocity macro to create links to each child page and 
>> at the chapter level I also start including the child pages. I then follow 
>> the links to make the child pages. This works relatively well but has a 
>> couple of disadvantages. 1) It is slow to create each page by repeatedly 
>> following the links, selecting the template and pasting the next tier of 
>> code. 2) It hardcodes the child page names which if changed (say due to a 
>> typo) must be updated by hand each time.
>> 
>> I am wondering if there is a more efficient way that I can automate the page 
>> and link creation process. Ideally I would have a way to create the complete 
>> page hierarchy by providing the names and levels of each page with the same 
>> code in each page providing a link to each child of that page. Then I could 
>> paste the content text into each page at the end of the branch. I have done 
>> something similar to this using Jeykell but that is much simpler as it is 
>> static content based on the file structure. If I am going about this all the 
>> wrong way I am open to other suggestions.
>> 
>> Regards,
>> 
>> Jesse
>> 
>> _______________________________________________
>> users mailing list
>> users@xwiki.org
>> http://lists.xwiki.org/mailman/listinfo/users
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users

_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to