7935 Posts in 1536 Topics by 943 members
|Go to End|
25 March 2010 at 7:54am Last edited: 25 March 2010 7:55am
For some reason I am getting the following error when I try to rebuild the db with SortableDataObject::add_sortable_class('Link'); in my _config file: [Notice] Undefined variable: _SESSION
These are my files:
class Link extends DataObject
static $db = array (
'AltText' => 'Varchar(50)',
'TitleText' => 'Varchar(50)',
'Description' => 'HTMLText', // HTMLText does not convert html tags to plan text
'LinkUrl' => 'Varchar(50)'
static $has_one = array (
'LinksPage' => 'LinksPage',
'LinkImage' => 'Image'
public function getDOMThumbnail()
return new FieldSet(
class LinksPage extends Page
static $has_many = array (
'Links' => 'Link'
public function getCMSFields()
$fields = parent::getCMSFields();
$manager = new DataObjectManager(
'DOMThumbnail' => 'Thumbnail',
'AltText' => 'AltText',
'TitleText' => 'TitleText',
'Description' => 'Link description',
'LinkUrl' => 'Url of link'
} // END of LinksPage
class LinksPage_Controller extends Page_Controller
} // END of LinksPage_Controller
25 March 2010 at 9:13am
You've got whitespace somewhere. Check all your PHP files and make sure there isn't any content being sent to the browser. You're closing your PHP tags.. you should remove those to prevent errors like this.
25 March 2010 at 1:02pm
Thanks Uncle Cheese!
Yup, there was white space at the end of the Link.php file that was creating the error. Removed it, now the sortable object works.
So, are you saying to use the opening php tag "<?php" but not the closing one "?>" as a general rule of thumb in my SS php files?
25 March 2010 at 1:36pm
Yeah, in an MVC framework, you should never have to close a PHP tag.
25 March 2010 at 4:33pm
I found this forum thread when looking for how to sort something in SS. I've now found the http://doc.silverstripe.org/doku.php?id=modules:sortabledataobject page but can't actually see where to download the module from. I've looked in the modules pages but can't see it there. Where do I get it from? Thanks!
25 March 2010 at 4:37pm
Ah never mind, I found it's contained within this extremely useful module which the forum topic is all about
|Go to Top|