What’s a comedy site without a comments thread?!

I wanted to add a comments form to each entry so that users could discuss each entry with one another. I had no desire to set limits or pagination for this, as comments wouldn’t take much to load.

Firstly I created a form (again using the template I had created previously, editing where necessary) in its own embed template – this was so that I could repeat the form on all single entry pages without repeating code over and over and over again.

The first tag pair started with {exp:comment:entries channel=”{embed:the_channel}”}. This allowed me to show how many comments there were in the heading. The variable {embed:the_channel} was entry page specific, where in the embed for this form I will add the channel name so that it knows what channel it is commenting on.

The second tag pair was {exp:comment:forml}. This is where I set the form to an EE dynamic form, assigning all channels to the form. This is an important stage as without it the form will not show up at all on the entry pages.

comments embed code

When this template was finished, I updated and finished editing. I then went to each single entry template, and under the channel entries tags, I wrote {embed=”embeds/entry_comments” the_channel=”gallery”}. You can now see the variable being passed into the embed function, explaining to the form what channel it is aiming at. Obviously for the single entry blog posts and videos, the channel name will be appropriate to the channel.

comments embed code in entry

Making sure comments were enabled on each channel, I went to a video and added a comment .Voila! A working comments form.

comments in entry

To further the use of this form, I added a comment count on the multi-entry pages.

Each entry had this added underneath the heading:

{if allow_comments}
({comment_total}) Comments

This shows how many comments are on each entry.

To show that this works, here is the entry I posted in above, which should display 2 comments as above.

underdogger comments

Awesome!!!!!! My website is now fully dynamic with multiple dynamic features.

There are a few tweaks I need to make and a few issues I need to resolve, but I will go over all of these and problems I had in the next couple of posts.