Jump to:

22999 Posts in 11854 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » debugging why a page wont "save & publish"

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1 2
Go to End
Author Topic: 865 Views
  • lozhowlett
    Avatar
    Community Member
    140 Posts

    debugging why a page wont "save & publish" Link to this post

    Hi everyone

    I have built a page "property details", however it now wont save and publish and of my "properties", i just get the little ajax loading symbol over the button, but it doesnt save... how do I debug where it might be getting stuck? I already have

    Director::set_environment_type("dev");

    turned on. This is my code....

    <?php
    class PropertyDetail extends Page {

       public static $db = array(
    'PropertyName' => 'Text',
    'RentPerMonth' => 'Currency',
    'NumberOfBeds' => 'Int',
    'Location' => 'Text',
    'Postcode' => 'Text',
    'StreetName' => 'Text',
    'Lat' => 'Text',
    'Long' => 'Text'
    );

       public static $has_one = array(
    'SearchResultPicture' => 'Image'
       );

    public static $has_many = array(
    'ImageResources' => 'ImageResource'
       );

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab("Root.Content.Main", new ImageField('SearchResultPicture'));
    $fields->addFieldToTab("Root.Content.Main", new TextField('PropertyName'));
    $fields->addFieldToTab("Root.Content.Main", new CurrencyField('RentPerMonth'));
    $fields->addFieldToTab("Root.Content.Main", new NumericField('NumberOfBeds'));
    $fields->addFieldToTab("Root.Content.Main", new TextField('Location'));
    $fields->addFieldToTab("Root.Content.Main", new TextField('Postcode'));
    $fields->addFieldToTab("Root.Content.Main", new TextField('StreetName'));
    $fields->addFieldToTab("Root.Content.Main", new TextField('Lat'));
    $fields->addFieldToTab("Root.Content.Main", new TextField('Long'));

    $managerimages = new ImageDataObjectManager(
    $this, // Controller
    'Images', // Source name
    'ImageResource', // Source class
    'Attachment', // File name on DataObject
    array(
    'Title' => 'Title'
    ), // Headings
    'getCMSFields_forPopup' // Detail fields
    // Filter clause
    // Sort clause
    // Join clause
    );
    $fields->addFieldToTab("Root.Content.Image Gallery",$managerimages);

    return $fields;
    }

    }
    class PropertyDetail_Controller extends Page_Controller {
       public static $allowed_actions = array (
       );

       public function init() {
    parent::init();
       }
    }

    Thanks!

  • vwd
    Avatar
    Community Member
    158 Posts

    Re: debugging why a page wont "save & publish" Link to this post

    Hi,

    Do you use an IDE for development? (Eg. I use Netbeans with XDebug enabled, and I'm able to set breakpoints in code and and step through.)

    If you're able to set a breakpoints and debug, set a breakpoint on AssetAdmin::save(...) [line 686 of cms/code/AssetAdmin.php] or its parent LeftAndMain::save(...) [line 624 of cms/code/LeftAndMain.php]. Then single-step through and see what's going on.

    VWD.

  • lozhowlett
    Avatar
    Community Member
    140 Posts

    Re: debugging why a page wont "save & publish" Link to this post

    I do use netbeans, i am new to using it tho... and I dont run the site locally, its run on our live server, so I dont think this will work? If i can get it running locally then this might be doable?

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: debugging why a page wont "save & publish" Link to this post

    yes if you run locally you can debug easily and quickly with net beans

  • lozhowlett
    Avatar
    Community Member
    140 Posts

    Re: debugging why a page wont "save & publish" Link to this post

    what would i need to run locally.... xamp, mysql.... anything else?

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts

    Re: debugging why a page wont "save & publish" Link to this post

    depends on your system - i use wampserver (that includes evenything needed)

  • lozhowlett
    Avatar
    Community Member
    140 Posts

    Re: debugging why a page wont "save & publish" Link to this post

    I am running windows 7 Ultimate edition... thanks

  • lozhowlett
    Avatar
    Community Member
    140 Posts

    Re: debugging why a page wont "save & publish" Link to this post

    ok i set the site up locally and it saves perfectly! How odd?!?

    865 Views
Page: 1 2
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.