[xwiki-devs] Create a new page referencing a template
I'm trying to create a new document (page) and have the page reference a template. For example: #set($mydoc = $xwiki.getDocument("$myblogpage")) #if($mydoc.isNew()) ##new page created #set($content = "#template('blogmacros.vm')") $mydoc.setContent("$content") $mydoc.save() #end The problem is that all of the velocity statements are processed when added the template is added to the to the page. I tried to prevent processing by wrapping #template(.... with {pre}{pre} but it had no effect. So I tried to copy the document which already referrs to the template but this fails without any error message and never hits my breakpoint in XWiki.copyDocument #if(!$xwiki.exists("$myblogpage")) #if($xwiki.copyDocument($testpage , $myblogpage)) ##successfully copied #else ##failed to copy #end #end It seems like this should be easy what am I missing? Thanks for any help. Glenn Everitt -- View this message in context: http://www.nabble.com/Create-a-new-page-referencing-a-template-tp17741202p17... Sent from the XWiki- Dev mailing list archive at Nabble.com.
I'm trying to create a new document (page) and have the page reference a template. For example:
#set($mydoc = $xwiki.getDocument("$myblogpage")) #if($mydoc.isNew()) ##new page created #set($content = "#template('blogmacros.vm')")
What happens if you write: #set($content = '#template("blogmacros.vm")')
$mydoc.setContent("$content") $mydoc.save() #end
The problem is that all of the velocity statements are processed when added the template is added to the to the page. I tried to prevent processing by wrapping #template(.... with {pre}{pre} but it had no effect.
So I tried to copy the document which already referrs to the template but this fails without any error message and never hits my breakpoint in XWiki.copyDocument
#if(!$xwiki.exists("$myblogpage")) #if($xwiki.copyDocument($testpage , $myblogpage)) ##successfully copied #else ##failed to copy #end #end
It seems like this should be easy what am I missing?
Thanks for any help.
Glenn Everitt
-- View this message in context: http://www.nabble.com/Create-a-new-page-referencing-a-template-tp17741202p17... Sent from the XWiki- Dev mailing list archive at Nabble.com.
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
see http://velocity.apache.org/engine/devel/user-guide.html#stringliterals
I'm trying to create a new document (page) and have the page reference a template. For example:
#set($mydoc = $xwiki.getDocument("$myblogpage")) #if($mydoc.isNew()) ##new page created #set($content = "#template('blogmacros.vm')")
What happens if you write: #set($content = '#template("blogmacros.vm")')
$mydoc.setContent("$content") $mydoc.save() #end
The problem is that all of the velocity statements are processed when added the template is added to the to the page. I tried to prevent processing by wrapping #template(.... with {pre}{pre} but it had no effect.
So I tried to copy the document which already referrs to the template but this fails without any error message and never hits my breakpoint in XWiki.copyDocument
#if(!$xwiki.exists("$myblogpage")) #if($xwiki.copyDocument($testpage , $myblogpage)) ##successfully copied #else ##failed to copy #end #end
It seems like this should be easy what am I missing?
Thanks for any help.
Glenn Everitt
-- View this message in context: http://www.nabble.com/Create-a-new-page-referencing-a-template-tp17741202p17... Sent from the XWiki- Dev mailing list archive at Nabble.com.
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (2)
-
Glenn Everitt -
Marius Dumitru Florea