Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

facebook twitter

i am working on an ecommerce website

each product has its own page with its own web address url (website.com/product1.php)

I am told to add
facebook like button
twitter button


what do these buttons do
0
rgb192
Asked:
rgb192
  • 4
  • 3
  • 2
2 Solutions
 
PapertripCommented:
0
 
Kevin CrossChief Technology OfficerCommented:
For the Facebook Like, please see http://developers.facebook.com/docs/reference/plugins/like/
After you generate the code you want, you should see something similar to this:
<div class="fb-like" data-href="http://website.com/product1.php" ...></div>

Open in new window

Per the documentation, "The XFBML version defaults to the current page." Therefore, if you are using the Javascript SDK (http://developers.facebook.com/docs/reference/javascript/), then you do not need to worry about specifying the URL.
In that case, the data-href attribute should be removed:
<div class="fb-like" ...></div>

Open in new window


If you need to use the other method, then change the data-href to be dynamically filled by PHP code however you like. One option is by using server variables http://php.net/manual/en/reserved.variables.server.php.

For the Twitter button, please see http://twitter.com/about/resources/tweetbutton. Same thing as above. There is an option that to use "The URL for the page the button is on." If you want control over the URL, the attribute there is data-url.

Hope that helps!

Kevin
0
 
Kevin CrossChief Technology OfficerCommented:
It looks like I took too long to type all that out, but hopefully there is something useful to add to the first Expert's post.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
PapertripCommented:
You definitely added something useful :)

I'm not a PHP pro so I didn't go into the detail you did, but then again the question wasn't asking how to code it so I felt comfortable replying.
0
 
Kevin CrossChief Technology OfficerCommented:
And for the second part of the question, those buttons are for socialization through the sites specified. This is important with the search algorithms of providers like Google where the fact that users actually Like or have linked to your site via Twitter helps with rankings. Aside from that, if Marketing of your content is important, they help you get targeted advertising. i.e., being a database person, most of the people that read my tweets like database information, so are more likely to read a page I tweet. It is just a way to get to target customers through social engineering. :)
0
 
rgb192Author Commented:
I understood the facebook button,
how can I work the twitter button
http://twitter.com/about/resources/tweetbutton

I was not given the html code on twitter

0
 
PapertripCommented:
Did you read the links I posted?  All the info you need is in both of those links.
http://www.jhuskisson.com/code-tidbits/share-on-twitter-link

Aside from that, the link you just referenced has an output box of the HTML code constructed from what you put into the text boxes.
0
 
PapertripCommented:
Another link for you to read.
https://dev.twitter.com/docs/tweet-button
0
 
rgb192Author Commented:
both great answers, thanks
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now