Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Tutorial 2: Parse error: parse error, unexpected T_VARIABLE in C:\lighttpd\htdocs\tutorial\code\ArticlePage.php on line 19

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1019 Views
  • OldLady
    Avatar
    Community Member
    1 Post

    Tutorial 2: Parse error: parse error, unexpected T_VARIABLE in C:\lighttpd\htdocs\tutorial\code\ArticlePage.php on line 19 Link to this post

    I'm just going through the second tutorial and am getting an error after adding this:

    function getCMSFields() {
    $fields = parent::getCMSFields();

    $fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
    $fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');
       
    return $fields;
    }

    to the ArticlePage file - any ideas?

    Full file now looks like this:

    <?php
    /**
    * Defines the ArticlePage page type
    */

    class ArticlePage extends Page {

    static $db = array(
       'Date' => 'Date',
        'Author' => 'Text'
    );

    static $has_one = array(
    );

    function getCMSFields() {
       $fields = parent::getCMSFields();

       $fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
       $fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');
       
       return $fields;
    }

    }

    class ArticlePage_Controller extends Page_Controller {

    }

    ?>

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