Skip to content

Commit

Permalink
MINOR: update docs to fix issues raised via comments. MINOR: remove s…
Browse files Browse the repository at this point in the history
…ection on comments.
  • Loading branch information
wilr committed Mar 30, 2012
1 parent 7c1b40d commit 18a1cc1
Showing 1 changed file with 1 addition and 42 deletions.
43 changes: 1 addition & 42 deletions docs/en/tutorials/2-extending-a-basic-site.md
Expand Up @@ -87,7 +87,6 @@ We'll start with the *ArticlePage* page type. First we create the model, a class
}
?>


Here we've created our data object/controller pair, but we haven't actually extended them at all. Don't worry about the
Expand Down Expand Up @@ -116,8 +115,6 @@ Let's create the *ArticleHolder* page type.
class ArticleHolder_Controller extends Page_Controller {
}
?>


Here we have done something interesting: the *$allowed_children* field. This is one of a number of static fields we can
Expand Down Expand Up @@ -249,7 +246,7 @@ Let's walk through these changes.
*$dateField* is added only to the DateField in order to change the configuration.

:::php
$dateField->setConfig('showCalendar', true);
$dateField->setConfig('showcalendar', true);

Set *showCalendar* to true to have a calendar appear underneath the Date field when you click on the field.

Expand Down Expand Up @@ -424,44 +421,6 @@ This will change the icons for the pages in the CMS.
![](_images/icons2.jpg)

### Allowing comments on news articles

A handy feature built into SilverStripe is the ability for guests to your site to leave comments on pages. We can turn
this on for an article simply by ticking the box in the behaviour tab of a page in the CMS. Enable this for all your
*ArticlePage*s.

![](_images/comments.jpg)

We then need to include *$PageComments* in our template, which will insert the comment form as well as all comments left
on the page.

**themes/tutorial/templates/Layout/ArticlePage.ss**

:::html
...
<div class="newsDetails">
Posted on $Date.Nice by $Author
</div>
$PageComments
...


You should also prepare the *Page* template in the same manner, so comments can be enabled at a later point on any page.

![](_images/news-comments.jpg)

It would be nice to have comments on for all articles by default. We can do this with the *$defaults* array. Add this to
the *ArticlePage* class:

:::php
static $defaults = array(
'ProvideComments' => true
);


You can set defaults for any of the fields in your data object. *ProvideComments* is defined in *SiteTree*, so it is
part of our *ArticlePage* data object.

## Showing the latest news on the homepage

It would be nice to greet page visitors with a summary of the latest news when they visit the homepage. This requires a
Expand Down

0 comments on commit 18a1cc1

Please sign in to comment.