Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

Referencing the second tutorial, my "'ProvideComments' => true" not working


Go to End


2 Posts   2339 Views

Avatar
yardiff

Community Member, 2 Posts

13 June 2008 at 4:37pm

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

Avatar
yardiff

Community Member, 2 Posts

16 June 2008 at 11:02am

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