Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Referencing the second tutorial, my "'ProvideComments' => true" not working

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: 1898 Views
  • yardiff
    Avatar
    Community Member
    2 Posts

    Referencing the second tutorial, my "'ProvideComments' => true" not working Link to this post

    Here's the code I've put into the /var/www/sstripe/tutorial/code/ArticlePage.php file:

    <?php
    /**
    * Defines the ArticlePage page type
    */
    class ArticlePage extends Page {
    static $db = array(
    'Date' => 'Date',
    'Author' => 'Text'
    );
    static $has_one = array(
    );
    static $icon = "tutorial/images/treeicons/news";
    static $defaults = array(
    'ProvideComments' => true
    );

    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 {
    }

    ?>

    I'd appreciate a pointer as to where I've gone wrong. Using version 2.2.2 in a Debian 4 environment.

    Thanks!
    Yardiff

  • yardiff
    Avatar
    Community Member
    2 Posts

    Re: Referencing the second tutorial, my "'ProvideComments' => true" not working Link to this post

    More background that I should have provided. Here is my "ArticlePage.ss" file:
    =============================
    <% include Menu2 %>

    <div id="Content" class="typography">
    <% include Breadcrumbs %>
    <h1>$Title</h1>
    $Content
    <div class="newsDetails">
    Posted on $Date.Nice by $Author
    </div>
    $PageComments
    </div>
    =============================
    When I manually tick the "Allow comments in this page" in the CMS and save/publish, it works for that page. So I know that the $PageComments section in there is correct and working properly.

    It just seems to be something with my $default array section. Any ideas where I've gone wrong? It's driving me somewhat crazy. I know it'll be something so silly-simple that I'll end up feeling more like an idiot than I already am.

    Thanks!
    Yardiff

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