velocity - Loop through a list of Tags and compare xWiki -


i have xwiki project tag system implemented. trying solve this problem. when click on tag correct output want sort documents according other tags, means need way search multiple tags. have done list of documents tagged first tag use #foreach through each document tags need show.

#set ($tag = "$!{request.get('tag')}") #set ($list = $xwiki.tag.getdocumentswithtag($tag)) #foreach($doc in $list)     #set ($tags = $xwiki.tag.gettagsfromdocuments($doc))     #foreach($tg in $tags)          #if($tg == 'tutorial')         {{html}} #displaydocumentlist($doc false $blacklistedspaces){{/html}}          #end     #end  #end 

the above code looks documents tagged $tag , tutorial. not efficient not looking efficiency @ point of time, need work , above code not , have no idea why.

edit::::

i tried different solution. time $list , $list2 $list documents first tag , $list2 docs second tag. compare each document's full name 1 list every document's full name in second list. still not work. here's code,

#set ($tag = "$!{request.get('tag')}") #set ($list = $xwiki.tag.getdocumentswithtag($tag)) #set ($list2 = $xwiki.tag.getdocumentswithtag('tutorial'))   #foreach($doc in $list)      #foreach($doc2 in $list2)         #if($doc.fullname == $doc2.fullname)               $doc         #end     #end   #end 

edit 2::::

so #foreach loop gives me correct output problem want show $doc shown if #{{html}} #displaydocumentlist($doc false $blacklistedspaces){{/html}} valid. not because think first params supposed list , here $doc 1 document.

so, here how display document. once $doc use line show document, {{display reference="$doc"/}}

here link display macro


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -