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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Installing SilverStripe /

Getting SilverStripe up and running on your computer and on your web server.

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

Deprecation error for custom pages


Go to End


3 Posts   2000 Views

Avatar
whjonker

Community Member, 12 Posts

16 November 2016 at 9:42am

Edited: 17/11/2016 12:29am

Hi,

I have been working on a SS website on my desktop (Localhost - Install 3.4.0) . Everything worked perfectly fine, also the 3 additional custom pages that I created.

I just moved all the files to the webserver with a clean install. I can create a normal page, but when I want to create one of the custom pages (HomePage.php) an error appears "Notice at line 214 of /../public_html/framework/dev/Deprecation.php".

I don 't think I used any deprecated coding as I did not see any deprecation errors on my local install. Can anyone please tell me what I am doing wrong? The code that I used for the HomePage.php can be found below.

PHP version Local (Wamp server) 5.5.12
PHP version Web server 5.4.45

Thank you in advance

<?php

class HomePage extends Page {
	
	private static $db = array (
		'FeaturedTitle' => 'Text',
		'FeaturedContent' => 'Text',
		
	);
	
	private static $can_be_root = true;


	public function getCMSFields() {
		$fields = parent::getCMSFields();
		$fields->addFieldToTab('Root.Main', TextField::create('FeaturedTitle','Featured Heading'),'Content');
		$fields->addFieldToTab('Root.Main', TextareaField::create('FeaturedContent','Featured Content'),'Content');
		
		
		
		$fields->removeFieldFromTab("Root.Content.Main","Content");
		$fields->removeFieldFromTab("Root.Content.Main","Title");
		$fields->removeFieldFromTab("Root.Content.Main","LessonsTitle");
		$fields->removeFieldFromTab("Root.Content.Main","CostsTitle");
		$fields->removeFieldFromTab("Root.Content.Main","LessonsContent");
		$fields->removeFieldFromTab("Root.Content.Main","CostsContent");
		$fields->removeFieldFromTab("Root.Content.Main","AgendaTitle");
		$fields->removeFieldFromTab("Root.Content.Main","ContactTitle");

		return $fields;
	}
	
	
	public function getValidPerformances() 
{
    return FeaturedPage::get()
       ;
}
	
	private static $allowed_children = array('FeaturedPage');
}

class HomePage_Controller extends Page_Controller {

	
}
[/code}

Avatar
wmk

Community Member, 87 Posts

17 November 2016 at 8:35pm

Seems the error reporting settings are different on your live server. Generally you want to show every error and notice while developing and hide notices and deprecation warnings on the live machine.

See: http://php.net/manual/de/function.error-reporting.php

What SilverStripe Version are you using? Can you see anything more in the error logs?

I guess, removeFieldFromTab() throws the deprecation message, as you want to remove from "Root.Content.Main" instead of "Root.Main" where you added the fields.

Avatar
whjonker

Community Member, 12 Posts

22 November 2016 at 3:19am

Thank you for your help WMK. Changing Root.Content.Main to Root.Main did the trick! :)