Jump to content

Button on dashboard that creates new page with a specific template


Jon
 Share

Recommended Posts

Hello all,

Just wonder if it's to add a new button on custom admin page that adds a new page with a specific template. I have got the parentid within the button link that works but would really like to set the template aswell.

Cheers

Jon

Link to comment
Share on other sites

Hello Mr Fan,

That is similar to the code I've used, But doesn't set the template. Basically what I have is a parent "Reviews" which can have 3 different Child templates. When dashboard button is press I would like to set a specific template or even if I could set a default template but still have the option of selecting the 2 other templates. What happens at the minute is the last template used if remembered. 

Cheers

Jon

Link to comment
Share on other sites

You can set a default template by supplying the GET parameter “template_id”, or the POST parameter “template”:

http://example.com/processwire/page/add/?parent_id=1024&template_id=46

I’m not sure about forcing the template. You could probably specify a default name format in order to bypass the page-add screen directly, or hook into ProcessPageAdd to manipulate the form.

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...