744 Posts in 309 Topics by 287 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 371 Views |
-
single content widget depreciated: SOLVED

9 December 2012 at 7:02pm
Hi Guys
I get this error (growl) when trying to open a page with this widget running (SS3.0.2)
Notice at line 168 of /nfs/c03/h01/mnt/81833/domains/youthguarantee.net.nz/html/framework/dev/Deprecation.php
Does anyone know how to fix this? My guess is theres something wrong in the php file:
<?php
/**
* Widget to display a single Page Content
* @package widgets.singlecontent
* @author Rui Godinho
*/
class SingleContentWidget extends Widget {
static $title = '';
static $cmsTitle = 'Single Content';
static $description = 'Adds content from a child page to the widget sidebar.';
static $db = array(
'WidgetTitle' => 'Varchar(255)',
'SinglePage'=>'Varchar(255)'
);
static $defaults = array(
'SinglePage'=>'home'
);
function Title() {
return $this->WidgetTitle ? $this->WidgetTitle : self::$title;
}function getCMSFields() {
// TODO: Usar TreeDropdownField when bug fixed
return new FieldSet(
new TextField('WidgetTitle', _t('TITLE','Title (optional)')),
new TextField('SinglePage', _t('SINGLEPAGE', 'The URL segment of the page to display.'))
);
}
/**
* Return a Single Content Page
* @return DataObject
*/
function SingleContent() {
$page = DataObject::get_one('SiteTree', "URLSegment = '". Convert::raw2sql($this->SinglePage) . "'");
if(!$page) {
return false;
}
else {
return $page;
}
}
}thanks all.
/w -
Re: single content widget depreciated: SOLVED

10 December 2012 at 8:07am
2 things to add to this:
1) The widgets works ok on my local site (MAMP) which uses PHP5.3.6
2) The hosting server is using PHP5.3.15I see that Silverstripe says the min requirements to run is PHP5.3.2 - could this be the problem i wonder?
-
Re: single content widget depreciated: SOLVED

10 December 2012 at 1:21pm
OK so its not the PHP ... I've now deployed to server running PHP5.3.3.7 and the problem persists.
/w
-
Re: single content widget depreciated: SOLVED

10 December 2012 at 1:58pm
The error message will tell you that FieldSet is deprecated and you should use FieldList instead (in your getCMSFields() methods). This will only show when using a site in dev mode and with your php.ini settings display_errors to On.
-
Re: single content widget depreciated: SOLVED

15 December 2012 at 8:37pm Last edited: 15 December 2012 8:37pm
OK so the problem was fixed in the end buy taking out a bunch of customisations in the _config file, not by changing the Content widget at all.
The config file is now stripped right back to the original fresh instal version and all seems OK.
Thanks for the info on dev mode though Simon, goona need to employ that now re my next problem (http://www.silverstripe.org/general-questions/show/21727#post318797)
Cheers
Wil
| 371 Views | ||
|
Page:
1
|
Go to Top |

