Home > Enterprise >  How do I allow users to create new pages and save them serverside?
How do I allow users to create new pages and save them serverside?

Time:10-10

I am currently building a personal wiki and I'm having difficulty in creating new article pages without coding them or pasting a blank template.

I've tried DOMImplementation but it's not quite what I'm after, I just want to be able to press a button and a new page is created serverside which I can write in and save, I've looked around on the internet a lot but I keep going in circles.

If anyone can point me in the right direction or show me how that would be awesome. I also have another problem of including a link to the new file on the index but I could try to sort that out on my own.

Any help is greatly appreciated, thanks.

CodePudding user response:

What you are looking for is probably dynamic pages.The general idea is:

  1. You provide an interface on the frontend for the user to type in the content of the page.

  2. When the content is submitted to the backend, it is saved to a database and it's id is returned for someone to visit the page later on.

  3. On the backend, you create a new endpoint that expects an id, with said id, you query the database and get the contents saved previously.

  4. This fetched content is used to populate a html template and this html is returned as the response to the frontend

  • Related