Hey,
I created a class with the correspondig design sheet, class template and template provider. Now I want to create automatically a child page when an instance is created. I tried it with code in the class template, but it didnt work. Can you help me ?
Projects is the space of my created class. And I´m not sure if I understand the function of the class template. Is the code inside only executed whenn an instance is created or always ?
The Template is a page. In your code to create a new page instance, you must copy the template (basically create a new page that is a copy of the template).
In this example the template is passed in the query string for editing a new page. The “inline” action code knows this “template” parameter and creates a new page, that is a copy of the template page.
Thank you for your answer. Ok and how can achieve my goal, that when I create a page of this class with the template provider, a childpage of the page is also created ?
Make the template a nested page and add as many child pages as you need. The template along with its child pages will be copied over when you create a new page from this template.
use a custom create page form, that besides creating the page creates the child pages also
write an event listener, that creates the child pages whenever a new page is created from that template
The first option is definitely the easiest, as long as the names of the child pages are static.