Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Alita Edmonds
Alita Edmonds
6,068 Points

How to make Comments?

Hi! I am making a blog and I want people to be able to talk using that blog. How would I make a comment button underneath an image that would be a place to talk about that image that other people could see? What language would be essential for doing this? Is there a snippet of code I could use? Thanks for help!

2 Answers

You'll want an intermediary or backend language; you have to store the comments somewhere (generally, a database). You could use PHP (typically with MySQL as a database), Node (typically with MongoDB), or any number of other popular languages. Treehouse has several courses on both PHP and Node that would be really useful to you in this regard.

As far as snippets, you could certainly search the web and find plenty of code snippets from other people to use. However, bear in mind there is significant risk (both to you and your users) of using someone else's code that you don't fully understand. How do you know they aren't sending or stealing the data? How do you know they aren't accessing your server or worse? How do you know they aren't downloading malicious files to your users (which you would be responsible for, as it's your website)?

Blogs are pretty fun to build (and relatively straightforward so far as first projects go) - would definitely encourage you to look at some of the Treehouse courses on Node or PHP. After taking those courses you should have the knowledge you need to build your blog as you see fit (without needing to get snippets - or at the least being able to understand the code you're copying).

Alita Edmonds
Alita Edmonds
6,068 Points

Thank you so much! I will look into courses and snippets. I really appreciate your help. Thanks again!