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.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Generated with the default template

Go to End

17 Posts   9030 Views


Community Member, 8 Posts

3 October 2010 at 9:39am


I have the same issue after upgrading and suspect it will be the same thing as mentioned here....
Where is this file located?

"You do have class HomePage_Controller extends Page_Controller{} in your HomePage extends Page class?"



Forum Moderator, 1850 Posts

4 October 2010 at 2:14am

"that file" is his own custom file, probably named HomePage.php to auto include it, it is unlikely to be your issue... When upgrading there is an odd bug that blanks out the class name of entries in Sitetree & Sitetree_Live that I have seen to then do the "Generated with the default" error.

To fix (or just to check) open Sitetree & Sitetree_Live and for any rows without a class name add it back in.


Community Member, 63 Posts

8 June 2011 at 9:07pm

For anyone who is interested, I screwed up my database by uploading old page controller (page.php) this deleted classes in the database therefore when i reinstated correct page controller the classes were still deleted. I had to go in and add the page classes manually, pain but better than dead database. Thus another way this could happen.


Community Member, 59 Posts

21 June 2011 at 4:43pm

I'm using SS 2.4.5 and have made an AboutPage class

class AboutPage extends SiteTree {
	public static $db = array(	);

	public static $has_one = array(	);
class AboutPage_Controller extends ContentController {
public function init() {

but am getting the
Generated with the default template

i've done the dev/build?flush=all and checked the AboutPage ClassName is in the Sitetree and SiteTree_Live records

if i put an in the templates dir it works
but if I rely on the default to work like on the Tutorial 1 and for SS to pick up my template in the Layout dir - it doesn't

It looks like in removing the 'old' Page class and just having a SiteTree class this functionality has been broken?

Is there an explanation about this 'feature' I haven't found yet?
Maybe Tutorial 1 needs to be updated for 2.4.5?



Forum Moderator, 1203 Posts

22 June 2011 at 5:34am

Edited: 22/06/2011 5:36am

There is a link between the Page class and The ContentController will not default to, since it knows nothing about it. For that to work you should have your controller extend Page_Controller instead. Unless you have serious reasons not to, I would suggest not removing the Page class, but using it to cover things that are valid for all pages, and base new Page types on it:

class AboutPage extends Page{
   public static $db = array(   );

   public static $has_one = array(   );
class AboutPage_Controller extends Page_Controller {
public function init() {


Community Member, 198 Posts

29 March 2012 at 10:28am

Edited: 29/03/2012 10:29am

Argh!! Struck this problem with a form on a couple of sites I have built this week!

My ContactPage.php file is:

class ContactPage extends Page
	static $db = array(
		'Mailto' => 'Varchar(100)', //Email address to send submissions to
		'SubmitText' => 'HTMLText' //Text presented after submitting message
	//CMS fields
	function getCMSFields() 
		$fields = parent::getCMSFields();
		$fields->addFieldToTab("Root.Content.OnSubmission", new TextField('Mailto', 'Email submissions to'));	
		$fields->addFieldToTab("Root.Content.OnSubmission", new HTMLEditorField('SubmitText', 'Text on Submission'));	
		return $fields;	


// Controller
class ContactPage_Controller extends Page_Controller
	//Define our form function as allowed
	static $allowed_actions = array(
	//The function which generates our form
	function ContactForm() 
      	// Create fields
	    $fields = new FieldSet(
		new LiteralField('', '<div class="stepone">'),
		new TextField('Name', 'Name*'),
		new TextareaField('StreetAddress', 'Street Address*'),
		new TextField('Telephone', 'Telephone*'),
		new EmailField('Email', 'Email*'),
		new TextareaField('Comments','Comments*'),
		new LiteralField('', '</div>')
	    // Create action
	    $actions = new FieldSet(
	    	new FormAction('SendContactForm', 'Send')
		// Create action
		$validator = new RequiredFields('Name', 'StreetAddress', 'Telephone', 'Email');
	    return new Form($this, 'ContactForm', $fields, $actions, $validator);
	//The function that handles our form submission
	function SendContactForm($data, $form) 
	 	//Set data
		$From = $data['Email'];
		$To = $this->Mailto;
		$Subject = "Dawson Waste Services Limited Website message";  	  
		$email = new Email($From, $To, $Subject);
		//set template
		//populate template
		//send mail
	  	//return to submitted message
		Director::redirect(Director::baseURL(). $this->URLSegment . "/?success=1");


	//The function to test whether to display the Submit Text or not
	public function Success()
		return isset($_REQUEST['success']) && $_REQUEST['success'] == "1";

For some dumb reason I can't change to the ContactPage page type in the CMS and save it - drop down menu still reads Change to Contact Page! Can anybody shed enlightenment?


Community Member, 198 Posts

29 March 2012 at 11:48am

Scrapping the Content Page in the CMS and setting up a completely new page, then changing the page type to content page worked. Nothing wrong with the template code/PHP etc. at all. Go figure...


Community Member, 94 Posts

8 April 2012 at 2:47am

Looks like all is solved on this thread but adding this for future searches...

Had a similar problem recently to arthurdent, found that I had loaded my live db in dev environment, which was missing my XYZPage.php - so the rows in the Sitetree table with ClassName = XYZPage now had ClassName = '' after a /dev/build.

That prevented me from updating the page type in the behaviour tab in the CMS, as you described experiencing. Even when I had uploaded XYZPage.php to the dev server and run /dev/build again.

In order to not lose the widgets and extra content I had added to the page (which I would have by deleting it and creating a new page), updating the row manually in Sitetree so the ClassName = 'Page' seemed to do the trick - I was then able to update the page type from inside the CMS.