Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

Create page using Front End

Go to End

9 Posts   1085 Views


29 August 2013 at 12:04am (Last edited: 29 August 2013 12:05am), Community Member, 21 Posts

Hi, usualy we create pages in Admin Panel, but I want to allow some users (They dont have permission log in to Admin Panel) to create pages using Front End. In Admin I created pages like this "Categories/Category/CategoryPage", so how could I transfer page creation method in Front End? So users could choose Category and then add CategoryPage to it?
Maybe where are some tutorials or maybe you could explain simple way of creating just one page in Front End with title and content which would be seen in Admin Panel and also in Front End ect.: News page? That would be a start for my idea:) Hope somebody will help, thanks


29 August 2013 at 12:13am Community Member, 189 Posts

Hi Johnny9,

To help guide you in the right direction, you would have to create a form and form handler function that creates a page for you based on the form input. It's important to remember that a "Page" in SilverStripe is really just a DataObject.

Form tutorial: [url][/url]

Tutorial on Creating DataObjects from the front end: [url][/url] - this is an older article but should help out.

Let me know how you make out and I will assist as best I can.


29 August 2013 at 12:30am Community Member, 21 Posts

Thanks IOTI. I will start by creating form and using these tutorials to build what I want. See you soon, because help will be needed :)


29 August 2013 at 5:58am Community Member, 21 Posts

So, I made upload form, with title, content and ect. All posts goes to database and I successfully return whem to front end. I did all this using that first tutorial. But what should Į do, that these database entries would be displayed in admin, like pages? Thanks for any tips :)


29 August 2013 at 8:02am Community Member, 21 Posts

Second tutorial is done.. But, still dont get, how to make form that could create page in admin and in front end :/


30 August 2013 at 12:19am (Last edited: 30 August 2013 12:20am), Community Member, 189 Posts

Hey Johnny

You know how to create a dataobject using a form thanks to the first tutorial I linked to. As I said earlier a page is really just a dataobject so you'll do pretty much the same thing. Your code would look something like this.

class Page_Controller extends ContentController {

public function CategoryForm(){
      $fields = new FieldList(
         new TextField('CategoryPageName', 'Name')               
      //action field
      $actions = new FieldList(
         new FormAction('CategoryFormHandler', 'Post')               
      //required Fields
      $requiredFields = new RequiredFields(
      //creating form
      $form = new Form(
      return $form;   

public function CategoryFormHandler($data,$form){
$page = new CategoryPage();

$page->Title = Convert::raw2sql($data['CategoryPageName']);


}else {
return $this->redirectBack();


This is a super basic example. You'll want to add some logic to make sure that the CategoryPageName the user entered isn't already taken.

You mentioned you also wanted the user to be able to pick a Category. You'd want to create a dynamic dropdown field that lists all of the category pages. Check out this tutorial for some tips on doing that: [url][/url].

Again let me know how you make out with this and I will assist as best I can.


30 August 2013 at 11:04pm Community Member, 21 Posts

Thanks for help IOTI :) will try to adapt your code soon.


31 August 2013 at 1:43am Community Member, 21 Posts

Yes!! It works! When you done step by step it is realy not so hard to do:) Really appreciate your help IOTI:)

Another step, I want to make, let users to choose Category (what I have done) and after they choose Category corresponding form appears.

Ect. Choose: Category A, appears Form A. Choose: Catefory B - appears Form B. I have idea how to make this, but if you know any more tips how to do this in right way, please share.

Go to Top