Search

I have a few sections where I want visitors be able to post comments. I have been playing around and I can’t seem to get it working without making a new comment section for each section. The only way I can make this work is to make a comment section for movie reviews, another comment section for book reviews, articles, etc. This is rather annoying and an inefficient way.

Is it possible to have one comment section linked to all the others without making a new one for each section? If so, how would I go about doing this.

The way I think you can do it is a little round about: You’d need to add a select box link to the Comment section for each section you wish to relate it to. Each of these select box links would need to be optional.

Then you could just add a datasource for each “type” of comment you wish to extract.

Does that make sense?

It’s easier than you’d think! Add a Select Box Link to your Comments section, so that you can link a comment back to another entry. I tend to call it “Attached To”, “Commented On” or “Parent”. A Select Box Link allows you to choose more than one section to link to (it’s a multi-select), so when you add the field to your section go ahead and select a field from each of your Movie Reviews, Book Reviews and Articles sections.

When you view a comment in the backend the Select Box Link dropdown will contain an optgroup for each related section.

When you submit a comment from the frontend, you just need to pass the ID of the entry you’re commenting on. So long as that ID is from an entry in one of the related sections (Movie Reviews, Book Reviews or Articles) then it’ll link up.

To get the comments attached to a particular entry, create a Data Source and filter the Select Box Link field by the parent entry ID. Again, so long as that ID is from an entry in one of the related sections (Movie Reviews, Book Reviews or Articles) then it’ll get the attached comments. You shouldn’t need to pass a “type” to the Data Source, just the parent ID.

What Nick had mentioned is how this website does its comments. The Blog, Forum, Showcase, Issues and tickets are all powered by one comment section.

For example, a forum thread is a forum entry and forum replies are comments to that thread. Same goes for issues and tickets.

Thanks for the replies! I got it working by creating a different comment datasource for each section then filtering them to their respective section.

What I did wrong before was that I was trying to use one datasource (“comments”) and filter all the entries to their respective section using select box link from there, but it wouldn’t let me add more than one {$param}. And when it did, it discarded the first param. Would be really cool if you could do it all from one datasource.

Anyway, thanks for the help!

I’ve always done it with a single section and data source, so it’s definitely possible. But if what you have works, great :-)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details