Which class/object to add for executing velocity

Hi.

I want to create a page template that includes some velocity code. But this code I don’t wont to have in the content but add an object with that code.

I found UIExtensionClass but with this I have to be sure, there is never printed output. I don’t want to use this class.

A MacroClass is only working when inside the content. So this isn’t a good way too.

I tried to build my own class (and use this as an added object) for that but I didn’t found a tutorial that fit’s my knowlegde.

What is a useful class/object I can take or (even better) how can I create this class by myself?

Bonus question: When I as an admin create the page template and user w/o scripting rights use this template (including the object with velocity) will this code executed when a normal user creates this page?

Regards, Simpel

What you seems to need is the sheet system.

You can indicate either at the level of the page itself or at the level of the xclass of an object you have in that page another page which will be in charge of the display/edition of the page. That’s what https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Tutorials/FAQTutorial/ is showing (that one only show the xlass based sheet system, but you can directly put a document sheet xobject in your template if you don’t need the user to customize the behavior of the sheet).

That’s also the system which is used when you create an application, for example, if you quickly want to generate something that use this to see how it looks.

1 Like