-1

I have a php program/app which asks for input, generate an image and post th image link to user's timeline (processor.php). I used PHP SDK in posting to timeline since I am more familiar with PHP. Now, in my gallery.php, i want to show like buttons for each generated image. I am aware that i have no option but use JS SDK in making button. but is it fine if i use two different SDK's in a single app?

    processor.php - PHP SDK
    gallerry.php - JS SDK

thanks for your answer! I would love to try your suggetions too

Jben Kaye
  • 171
  • 1
  • 5
  • 16
  • _“I am aware that i have no option but use JS SDK in making button.”_ – that assumption is wrong already. A pure iframe implementation of the like button exists. – CBroe Nov 05 '13 at 10:58
  • possible duplicate of [Facebook Login: How to combine JavaScript with PHP SDK?](http://stackoverflow.com/questions/6147631/facebook-login-how-to-combine-javascript-with-php-sdk) – Fabio Antunes Nov 05 '13 at 12:02

2 Answers2

0

There shouldn't be any problem using PHP and JS in the same application, quite a common use case. You would normally use PHP to create the Web Application structure, handle backend logic, and then use JS to handle UI events.

There's nothing special about combining the two, just create the Web page with JS as normal for the view, and use PHP to build it.

Hope this helps.

Malcolm Murray
  • 323
  • 2
  • 10
  • thanks @Malcolm. my web page is in PHP. and so the log in. i would only want to use the JS for the button. would that situation be fine still? thank you! and also, in JS do i need to include some .php program like the PHP SDK? thanks – Jben Kaye Nov 05 '13 at 09:59
  • That last question does not even makes sense. If you are unclear on how the JS SDK is used, then please go read the docs first. – CBroe Nov 05 '13 at 10:59
  • Hi @CBroe i have read some docs and tutorial. yet i am unclear with those. that's why i'm posting a question here. so that maybe, someone might make things clear to me. – Jben Kaye Nov 05 '13 at 11:33
0

Yes, there is no problem, the two APIs are designed to work together. The PHP API is usually used to created the backend logic (for example OAuth implementation, posting and getting data, etc) and the JS API to handle user iniated events.

Also see this: https://stackoverflow.com/a/6728092/1107118 on how to handle login state. Normally the JS API is used for logging in too, and then with the PHP API you take the access token and do the backend actions.

Community
  • 1
  • 1
Ion
  • 1,033
  • 2
  • 13
  • 18
  • thank you @lon. i have handled my log in with PHP i just want the buttons and it's JS. would it be fien if i dont change the way i hadle the log in? thanks – Jben Kaye Nov 05 '13 at 09:56