Code with C | Programming: Projects & Source Codes › Forums › HTML/CSS › Adding a comment section to the bottom of a webpage
October 6, 2016 at 11:50 am #10538
Just a simple question really.
I don’t want to add a third party program/code to my website.
eg this site
As it doesn’t offer me anything in the way of learning.
I have googled around and actually not been able to find much. Other than.
Using MySQL/PHP to do just this.
But it just seems extreme to me to do just a simple thing.
When I say comment section, I don’t mean a separate webpage. I want the ability for users/readers to comment to each webpage and them to be listed at the bottom like google blogs. So therefore each webpage this way would mean a database for each page?
Have I looked into this too much and there is a much simple way to do this?
October 6, 2016 at 11:52 am #10539
It’s hard to say with the information given, but depending on how many visitors, and how your site is constructed, 1 table (2 if you want users to register) should be enough.
In it’s most basic form it should have:
- The page (Can’t help you here, depends on your site)
- The name of the user posted (Or the user ID if your site has registered users)
- The date posted
- And of course the comment itself.
You could go a step further, by also logging the users IP addresses etc, but that’s up to you.
Then on each page, you can load the comments matching the page.
We can be more of a help when you give us some more information about your site.
October 6, 2016 at 11:53 am #10540
AdelaidMember1I don't mean a separate webpage. I want the ability for users/readers to comment to each webpage and them to be listed at the bottom like google blogs1seems extreme to me
Nope, it’s not extreme. For holding data, you’re going to want to use a database, of course, you could use the filesystem and write them to say .json files or .txt, but with MySQL you get a lot more power and control.1As it doesn't offer me anything in the way of learning.
Really? I do need to question your research skills, using the term “making a php comment form” I found this site:1http://stackoverflow.com/questions/1171997/php-mysql-how-to-create-a-comment-section-in-your-website
Stack-overflow is buzzing with questions just like yours, and it’s a valuable resource when trying to find out how to do somethings – or more than a few occasions it’s saved my bacon. What’s ironic is when you reply to this thread again you’ll realize there’s the exact functionality as you wanted – a comment box (text area), a submit button, sends data to the database, and when the page reloads, outputs the data from the database.
October 6, 2016 at 11:57 am #10541
In a very basic way :12345<div id="comments">< ?phpinclude("comments.php");?></div>
In your CSS sheet place the id “comments” on the bottom , within comments.php you can extract from your SQL db the comments or have them added , whatever you wish…
You must be logged in to reply to this topic.