Quantcast
Channel: XWiki Forum - Latest topics
Viewing all articles
Browse latest Browse all 1373

Get multiple xdom blocks in order

$
0
0

I have a page that has both paragraph and quotation block contents that are mixed. I am able to get both with the following snippet of code:

  #foreach ($block in $document.getXDOM().getBlocks('class:ParagraphBlock', 'DESCENDANT'))
    #set ($xwikiSyntax = $services.rendering.render($block, "xwiki/2.1"))
    $xwikiSyntax
  #end

  #foreach ($block in $document.getXDOM().getBlocks('class:QuotationBlock', 'DESCENDANT'))
    #set ($xwikiSyntax = $services.rendering.render($block, "xwiki/2.1"))
    $xwikiSyntax
  #end

The one problem here though is that the content is not rendered in order (i.e. all the paragraph content is rendered and then the quoted content; I’d like them to be printed out in their original order)

How would I do this?

Thanks.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 1373

Trending Articles