Jump to:

23378 Posts in 18298 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » [Solved]What's wrong with my code?

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
Go to End
Author Topic: 749 Views
  • zcm211
    Avatar
    Community Member
    18 Posts

    [Solved]What's wrong with my code? Link to this post

    Table YoutubePage: renamed to _obsolete_YoutubePage
    Table YoutubePage_versions: renamed to _obsolete_YoutubePage_versions
    Table YoutubePage_Live: renamed to _obsolete_YoutubePage_Live

    <?php
    class YoutubePage extends Page
    {
       static $db = array(
          #'YoutubeLink' => 'Text'
       );
       static $has_one = array(
       );
    }

    class YoutubePage_Controller extends Page_Controller
    {
       function getCMSFields() {
          $fields = parent::getCMSFields();      
          $fields->addFieldToTab('Root.Content.Main', new TextField('YoutubeLink'), 'YoutubeLink');
          return $fields;
       }
    }
    ?>

  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Re: [Solved]What's wrong with my code? Link to this post

    #'YoutubeLink' => 'Text'

    That's a parse error (#). Why is it there?

    And if you want help, it's a good idea to explain:

    1. What you are trying to do
    2. What error you are getting

    Cheers
    Aaron

  • zcm211
    Avatar
    Community Member
    18 Posts

    Re: [Solved]What's wrong with my code? Link to this post

    sorry, I want to add some costom fields, but there is no effect.

  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Re: [Solved]What's wrong with my code? Link to this post

    So now you're alright then? You see the problem?

  • zcm211
    Avatar
    Community Member
    18 Posts

    Re: [Solved]What's wrong with my code? Link to this post

    no,it is not alright. the page's Main tag still do not display the field I want.

  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Re: [Solved]What's wrong with my code? Link to this post

    Then why did you set the subject to [solved]?

    You need to be more detailed with your questions. I have pointed out the error in the code you posted.

    Cheers
    Aaron

  • zcm211
    Avatar
    Community Member
    18 Posts

    Re: [Solved]What's wrong with my code? Link to this post

    After I posted my second topics, I found I add the mehtod to the wrong class, so the error is fixed. Thanks for your attending.

    749 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.