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.

Data Model Questions /

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

Adding Comments to DataObjects


Go to End


20 Posts   6857 Views

Avatar
PokerVIP

Community Member, 1 Post

28 March 2012 at 6:03am

Any updates on this? Would love to be able to differentiate between data objects.

We currently have wordpress blogs on our site - could the new comments system for Silverstripe 3.0 be easily integrated with this or would it require a messy work around?

How long a wait are we looking at?

Avatar
Willr

Forum Moderator, 5523 Posts

28 March 2012 at 7:19pm

The comments module is live and working in 3.0 (apart from moderation and ajax posting) but not sure what you mean by integrate with the wordpress blog comments? There's currently no importer or exporter for comments and nothing on the roadmap for it.

Avatar
tv

Community Member, 44 Posts

5 December 2012 at 1:27am

Edited: 05/12/2012 6:11am

Hi Willr

I am using DataObjects as Pages and would like to use your Comments extension.

I have installed it and the CommentsForm is showing up on my DataObjects after placing the appropriate configuration in mysite/_config file.

I am using the following to render my Post DataObjects as Pages:

   public function view($request) {
        $segment = $request->param('ID');
        
        if ($obj = Post::get()->filter('URLSegment', $segment)->First()) :
            switch ($obj->Type) {
                case 'News-Post' :
                    return $this->renderWith(
                        array('PostsPage_view_news', 'Page'),
                        array(
                            'Object'    => $obj,
                            'Type'      => $obj->Type,
                            'Title'     => $obj->Title,
                            'Entry'     => $obj->Entry
                        )
                    );

My question is how would I pass through the $CommentsForm into the Postspage_view_news page?

I have tried the following, but while the form is being rendered, it is not associating the comments made through a form w/ a particular dataobject. Baseclass on comments made are set to SiteTree and not Post.

Avatar
tv

Community Member, 44 Posts

5 December 2012 at 7:50am

I was able to accomplish passing the form through the renderWith method using: 'CommentsForm' => $obj->CommentsForm().

Go to Top