♥ Welcome Webmaster!! ♥

I wanted to share this tutorial for adding little reaction buttons to your webpage. It's really easy to set up, so I hope you'll have fun with it ^_^ The tutorial uses PHP, Javascript, and regular ol' text files.

Your reaction buttons can use text symbols, emoji, GIFs, PNGs, or anything else you could use in HTML with a button really.

Ready to get started!?!?
(This is what we're making btw) ---->
01. ♥ SETTING UP YOUR FILES

Your web host needs to support PHP. Unfortunately, Neocities does not support .php :(

Put these files in the same folder as the page where you want to use reactions: (in this example, index.html will be the webpage where you put your button/s)

= file with text/code in it. = Folder
your-website/
├── index.html
├── reaction.js
├── get_count.php
├── submit.php
└── counts/
TIP: If you're having trouble getting the counter to function by the end of the tutorial, try changing the "counts" folder permissions to 755 or 775. Some hosting providers require this for PHP to write files.
02. ♡ CREATE get_count.php

Create a file named get_count.php and paste this entire code into it:

♡ NOTE: The counter data is stored on your own server. You don't have to worry if sweetcharm.net goes down, becuase you're hosting this yourself :D
03. ✿ CREATE submit.php

Create a second PHP file named submit.php.

04. ✧ CREATE reaction.js

Create a file named reaction.js.

05. ♥ ADD YOUR FIRST REACTION BUTTON AND SCRIPT TAG!!

Place this code on your page where you'd like a reaction button to appear:

Put the script tag somewhere before your last <body> tag.

You only need that once per page, even if you have 50 reaction buttons. If you don't add this one little piece of code on your page, the buttons wont update.

06. ✿ MAKE SURE YOUR CHARACTERS DISPLAY CORRECTLY

Using symbols such as ♥ ♡ ✦ ✧ ★ ☆ ☾ ☀ in your buttons is totally fine! But if you see things like ♥ instead of ♥ it usually means there's a mismatch between your code characters and how the browser is displaying characters. (I learned that things like ♥ are called "mojibaké" by the way XD)

This allows things like Japanese, accented characters, and other Unicode symbols to display properly: 日本語

Your HTML should contain this:

Put that line inside the <head> of your HTML page.

07. ✿ MAKE LOTS OF DIFFERENT REACTIONS

Just give each reaction its own ID:

Different data-reaction values = different/unique counters. Each data-reaction will create a text file the first time it's clicked. If you use the code directly above, it'll look like this in your files:
counts/
├── love.txt
├── cute.txt
├── sparkle.txt
├── fairy.txt
└── cookie.txt
TIP: You do NOT have to manually create any files INSIDE of counts/. The PHP scripts create them automatically! You DO have to create the counts folder first though.
08. ♡ SAME REACTION IN MULTIPLE PLACES

Want one reaction at the top AND bottom of a long page? Use exactly the same reaction ID (the data-reaction part in the code)

Since both use page-love , they share the same count.
09. ☆ USE A GIF OR IMAGE

Your reaction button can also have a tiny GIF, PNG, WebP, JPG, etc next to or in place of the text!!!

Replace images/fairy.gif with the path to your own image.

♡ GOOD FILENAMES: fairy.gif , fairy-love.gif , fairy_01.gif . Avoid spaces and weird punctuation when you can.
10. ♡ CUTE CSS FOR YOUR BUTTONS
Want your buttons to look a little cuter? Use this CSS to make the buttons on your page look like the ones in this tutorial.

Paste this into your site's CSS file, or inside a <style> tag in your HTML.

Here's a comparison with and without CSS applied:


Want the button smaller? Perhaps more obnoxious?? You can really just go crazy with the CSS.

Try this out on your page's CSS:

11. ☆ TINY REACTION BUTTON BUILDER

Don't feel like typing the button code yourself? Put your info in here!

Reaction ID
This will make a new folder on your site with the reaction ID you decide on.
Button text
Icon type
Text icon
Type a symbol, emoji, or text.
Image alt text
PREVIEW:
COPY THIS:
♡ REMEMBER: If you want to use the same reaction in multiple places, give each button the same Reaction ID.
12. ✧ SILLY REACTION IDEAS

Here are some more samples/ideas you can click as much as your heart desires...refresh the page and you'll see the #s remain as if by magic.

♡ From Clover: I hope you have fun making silly little buttons all over your site!!!
13. ♥ YOU'RE DONE!

CONGLATURATIONs!!!

♥ You did it! (I presume anyway...?)
Your website now has tiny clicky things. Numby go UP. This is extremely important technology.