Create a new page from a velocity macro

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Create a new page from a velocity macro

xwiki.mexon
Hi, hopefully another easy question, I can't find anything in the
documentation.

I want to create a new page in a velocity macro.  I know how to create a
new object, with something like:

#set($object = $doc.newObject("My.Class"))
#set($discard = $doc.save())

But how do I do the same thing for a new page?

_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Create a new page from a velocity macro

Eugen Colesnicov
xwiki.mexon wrote
I want to create a new page in a velocity macro.  I know how to create a
new object, with something like:

#set($object = $doc.newObject("My.Class"))
#set($discard = $doc.save())

But how do I do the same thing for a new page?
#set($newDoc = $xwiki.getDocument('Sandbox.TestPage4'))
$newDoc.save()

--
Best regards
Eugen Colesnicov
Reply | Threaded
Open this post in threaded view
|

Re: Create a new page from a velocity macro

xwiki.mexon
On 2013-01-14 15:43 , Eugen Colesnicov - [hidden email] wrote:

> xwiki.mexon wrote
>> I want to create a new page in a velocity macro.  I know how to create a
>> new object, with something like:
>>
>> #set($object = $doc.newObject("My.Class"))
>> #set($discard = $doc.save())
>>
>> But how do I do the same thing for a new page?
>
> #set($newDoc = $xwiki.getDocument('Sandbox.TestPage4'))
> $newDoc.save()

That easy!  Thanks very much.


_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Create a new page from a velocity macro

vmassol
Administrator

On Jan 14, 2013, at 9:07 AM, [hidden email] wrote:

> On 2013-01-14 15:43 , Eugen Colesnicov - [hidden email] wrote:
>> xwiki.mexon wrote
>>> I want to create a new page in a velocity macro.  I know how to create a
>>> new object, with something like:
>>>
>>> #set($object = $doc.newObject("My.Class"))
>>> #set($discard = $doc.save())
>>>
>>> But how do I do the same thing for a new page?
>>
>> #set($newDoc = $xwiki.getDocument('Sandbox.TestPage4'))
>> $newDoc.save()
>
> That easy!  Thanks very much.

Added here:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/APIGuide#HCreateanewDocument

Thanks
-Vincent

_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users