treehouse : what would you like to learn today?
Web Design Web Development iOS Development

CodePen Like/Heart Counter

  • Does anyone know how this works? I've been looking all over the place for something similar to ZillaLikes but I no longer use Wordpress. I can't find the Javascript that it's using either.

    Would be pretty awesome if @chriscoyier put up the code on github.

  • I think they built it on Rails which I have absolutely no experience with (apart from installing Ruby gems for SASS/Compass once).

    However, if you were to do it on PHP that would definitely be possible. For example, you could setup a button, when clicked it adds +1 to a field in a users account in the MySQL database.

    Then you could use AJAX to complete the like request and update the database and then reload the new count.

  • Yah essentially that's it. Unfortunately there isn't some modular component that makes sense to open source. Each Pen and each User have data models. When a user clicks a heart, it sends a little Ajax call to the server which updates information in the database about how many hearts something has and who hearted it.

  • Gotcha. Thanks guys. I think I'll try to strip out ZillaLikes to fit Kirby.