Jump to:

7938 Posts in 1541 Topics by 945 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Error when Enabling DOM Drag and Drop Sort

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1208 Views
  • drewbs
    Avatar
    Community Member
    5 Posts

    Error when Enabling DOM Drag and Drop Sort Link to this post

    When inserting the "SortableDataObject::add_sortable_class('Slider');" into the _config.php file I get an _SESSION variable undefined error. Wondering if anyone else has seen this or if it is some fringe case (I assume it is) and what they did to fix it. Below is the error message and code for the 'Slider' class. And thank you Uncle Cheese for the great module.

    Error:

    GET /silver1/dev/build
    Line 120 in /var/www/silver1/sapphire/core/control/Director.php
    Source

    111          @file_get_contents('php://input')
    112       );
    113       
    114       // @todo find better way to extract HTTP headers
    115       if(isset($_SERVER['HTTP_ACCEPT'])) $req->addHeader("Accept", $_SERVER['HTTP_ACCEPT']);
    116       if(isset($_SERVER['CONTENT_TYPE'])) $req->addHeader("Content-Type", $_SERVER['CONTENT_TYPE']);
    117       if(isset($_SERVER['HTTP_REFERER'])) $req->addHeader("Referer", $_SERVER['HTTP_REFERER']);
    118
    119       // Load the session into the controller
    120       $session = new Session($_SESSION);
    121       $result = Director::handleRequest($req, $session);
    122       $session->inst_save();
    123
    124       // Return code for a redirection request
    125       if(is_string($result) && substr($result,0,9) == 'redirect:') {
    126          $response = new HTTPResponse();

    Trace

    * Director::direct(/dev/build)
    Line 118 of main.php

    Slider.php:

    <?php
    class Slider extends DataObject
    {
       static $db = array (
          'Title' => 'Text',
          'Content' => 'HTMLText',
          'Link' => 'Text'
       );
       
       static $has_one = array (
          'SliderImage'=>'Image',
          'HomePage' => 'HomePage'
          
       );
          
       public function getCMSFields_forPopup()
       {
          
          return new FieldSet(
             new TextField('Title'),
             new TextareaField('Content'),
             new SimpleTreeDropdownField("Link", "Link"),
             new FileIFrameField('SliderImage')   
          );
       }
    }
    ?>

  • drewbs
    Avatar
    Community Member
    5 Posts

    Re: Error when Enabling DOM Drag and Drop Sort Link to this post

    Problem Solved. After a day of punding my head against the wall I Had a trailing line after the ?>. Doh!!!

  • UncleCheese
    Avatar
    4085 Posts

    Re: Error when Enabling DOM Drag and Drop Sort Link to this post

    Never, ever, ever, ever use a closing PHP tag unless you're using PHP in a template.

    ?> = BAD

  • drewbs
    Avatar
    Community Member
    5 Posts

    Re: Error when Enabling DOM Drag and Drop Sort Link to this post

    Thanks for the tip I am pretty new to php. Did some googling and see why it is a problem and why it caused the error it did.

    1208 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.