hmm...
it's the same problem. if i use the first idea...it does not do anything, and if i
use the second one, i get to the same problem i originally had. it takes me only the last
template included. :(
No, there shouldn't be any problem. Why do you say it does not do anything?
By the way, you DO call $mydoc.save() after setting the content, right?
Sergiu Dumitriu <sergiu(a)xwiki.com> wrote:
Gabriela Radu wrote:
this only adds one template..
how do i add all my templates. more than 5 in my case.
Sergiu Dumitriu wrote: Gabriela Radu wrote:
hello. is it possible to set content into a page
, with code that comes from different templates? for example: treeheader, treepanelleft,
treepanelright
$mydoc.setContent('#template("treeheader.vm")')
$mydoc.setContent('#template("treepanelleft.vm")')
this does not work. it takes only my last template.
i know i can just put the all templates in one template and then include that template.
but i don;t want to do that and i want to include all the templates one by one.
do you know a way to do this? thx
setContent is a setter, not an adder. Try:
$mydoc.setContent("${mydoc.getContent()}#template('treepanelleft.vm')")
If you already know the templates, just do:
$mydoc.setContent("#template('template1.vm')#template('template2.vm')#template('template3.vm')#template('template4.vm')#template('template5.vm')")
Otherwise, just repeat the previous statement as many times as you want:
$mydoc.setContent("${mydoc.getContent()}#template('template1.vm')")
$mydoc.setContent("${mydoc.getContent()}#template('template2.vm')")
...
$mydoc.setContent("${mydoc.getContent()}#template('template5.vm')")