3 Replies - 2269 Views - Last Post: 28 January 2012 - 07:59 AM Rate Topic: -----

#1 mdmartiny  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 85
  • Joined: 28-May 10

Help in creating a like button

Posted 27 January 2012 - 08:54 PM

Hello Everyone,

I want to create a PHP function that acts like the Facebook like button. But I do not want to use the Facebook like button. I want it to be on my pages only. I am not sure on how to do this? Does anyone have any idea or point me to a place that can show me how to do it.

Thank you everyone for your help.
Is This A Good Question/Topic? 0
  • +

Replies To: Help in creating a like button

#2 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2891
  • View blog
  • Posts: 10,025
  • Joined: 08-August 08

Re: Help in creating a like button

Posted 27 January 2012 - 09:23 PM

If you want to change the icon that's an html question. If you want different behavior, then you need to define the behavior before you can code it.
Was This Post Helpful? 0
  • +
  • -

#3 Jstall  Icon User is offline

  • Lurker
  • member icon

Reputation: 434
  • View blog
  • Posts: 1,042
  • Joined: 08-March 09

Re: Help in creating a like button

Posted 28 January 2012 - 07:33 AM

Hi,

If I were doing this the first step I would take is designing the database structure necessary to achieve this. This would largely depend on your current schema and how you are intending on implementing the like system.

If I were doing this and was implementing the ability to "like" multiple types of entities in my site I would have at least the following fields in the table:

  • field to identify type of entity
  • identity of who liked it - user id if the system uses a login or ip address
  • primary key of entity that was liked


You would no doubt want to add more fields but with those you would be able to identify what was liked and only allow one person to like each thing.

After I had the database fleshed out I would start building classes to implement the logic for this system. Again this would largely depend on how your site currently works.
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3485
  • View blog
  • Posts: 10,045
  • Joined: 08-June 10

Re: Help in creating a like button

Posted 28 January 2012 - 07:59 AM

View Postmdmartiny, on 28 January 2012 - 04:54 AM, said:

I want to create a PHP function that acts like the Facebook like button. But I do not want to use the Facebook like button.

since I’m not on Facebook and I see this type of question quite often, what the heck is that "FB like"? (I have a guess, though)


View PostJstall, on 28 January 2012 - 03:33 PM, said:

You would no doubt want to add more fields but with those you would be able to identify what was liked and only allow one person to like each thing.

I recommend a Composite Key for that. any attempt to "like a thing" more than once leads to a unique constraint violation in SQL which can be handled easily.

This post has been edited by Dormilich: 28 January 2012 - 07:59 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1