Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
3 Ways to Implement Embeddable Custom Badges
Dec 29, 2014 @ 09:12:38

The SitePoint PHP blog has a recent tutorial showing you how you can use one of three different ways to embed badges into your site. These "badges" are a common practice among sites allowing other sites/applications to embed small statistics such as number of Tweets or Likes about a page.

One great way of organically promoting your application is to provide “badges”; snippets of content that people can embed on their own websites. [...] This can contain up-to-the-minute information from your application about a user, piece of content or another object, dynamically generated and inserted into other websites. In this article I’m going to take a look at some of the ways you can implement this.

He walks you through the creation of a simple application based on Silex, using Twig for template rendering and the WideImage library for creating the images. His datastore, a static array, lists an image, rank and number of "trophies" for each user of the system. He creates a main page showing all of the badges at once, making use of an "iframe" to contain the dynamically created image. He shows how to use the WideImage library to pull in the background, avatar and trophy images, merge them together and add a bit of text with the username and level ranking. Finally he includes the Javascript needed so the remote site can just use a "script" tag to pull in the rendered image and place it on their page.

tagged: tutorial badge embed javascript iframe silex twig wideimage

Link: http://www.sitepoint.com/3-ways-implement-embeddable-custom-badges/

David Müller:
Cross Domain AJAX Guide
Dec 10, 2012 @ 12:17:39

In his latest post David Müller covers some of the things to consider when working with cross-domain ajax requests including CORS and iframes.

As it is widely known, AJAX Requests are only possible if port, protocol and domain of sender and receiver are equal. [...] Having this cleared out, we will cover ways around this restriction.

He covers three main approaches to allowing these cross-domain requests (and some of the security implications that can come with them):

  • CORS (Cross Origin Resource Sharing)
  • JSONP (Javascript with a local domain callback)
  • Iframes

He also briefly mentions things like window.postMessage (HTML5) and the use of a backend script to proxy a request into your application's local code.

tagged: crossdomain ajax cors iframe jsonp tutorial introduction

Link:

SocialDevelopers.net:
Facebook and the Zend Framework - Part 1: Iframe Authentication
Feb 04, 2011 @ 14:42:58

On the SocialDevelopers.net blog there's a new tutorial posted that helps Zend Framework developers connect their applications to Facebook. This article is the first in a series and talks about one of the simplest integration methods - the iframe.

We are proud to present our first ever tutorial, aimed at helping Zend Framework developers to integrate their iframe applications into Facebook using the new(ish) OAuth for Canvas authentication mechanism. This is the first part in a three part series aimed at building a fully working Facebook Iframe application using the Zend Framework.

The tutorial is posted in a downloadable PDF to you can take it anywhere your code goes for easier reference.

tagged: facebook tutorial zendframework iframe authentication

Link:

Emran Hasan's Blog:
Quick start on new Facebook PHP SDK (IFrame based)
May 04, 2010 @ 10:39:05

If you're looking for a stripped down, bare-bones look at how to get started with interfacing your PHP script with Facebook, take a look at this quick guide from Emran Hasan.

The new Facebook API has already spread over the application developers and if you’re like me, you’ve already got your hands dirty to see how this new thing works. If you have tried to follow the documentation to authorize/get session in your canvas application, it is likely you have already hit roadblocks. Well, I am no savior but I have glued together a few clues and got it working for myself.

He walks you through the three simple steps: getting the new API, setting ip a correct configuration file and creating a sample "main page" for your application that echoes out a "Hello World" sort of message to each visitor.

tagged: facebook api iframe tutorial quickstart

Link:

AnyExample.com:
PHP AJAX example: asynchronous file upload
Dec 05, 2006 @ 14:23:54

As mentioned by the Zend Developer Zone, there's a new tutorial over on the AnyExample.com website that shows how to get up and working with a PHP+Ajax connection in no time flat. The goal? To handle a file upload asynchronously from the user.

This article contains example application (trivial file-sharing service, like rapidshare, megaupload or yousendit) which uses embedded frames (IFRAME) to upload file. While file is uploaded to hidden frame, user can still access web-page and fill "file description" field.

They talk briefly about the PHP functions that will be used in the tutorial and the concept of using IFRAMEs to handle the content coming in (without reloading the page). The rest of the article is a code dump showing the pieces of (procedural) code to get the job done. There's some commenting, but if you're a new coder to PHP, you might want to check out the main PHP site for some more information on the functions used.

tagged: ajax tutorial asynchronous file upload iframe ajax tutorial asynchronous file upload iframe

Link:

AnyExample.com:
PHP AJAX example: asynchronous file upload
Dec 05, 2006 @ 14:23:54

As mentioned by the Zend Developer Zone, there's a new tutorial over on the AnyExample.com website that shows how to get up and working with a PHP+Ajax connection in no time flat. The goal? To handle a file upload asynchronously from the user.

This article contains example application (trivial file-sharing service, like rapidshare, megaupload or yousendit) which uses embedded frames (IFRAME) to upload file. While file is uploaded to hidden frame, user can still access web-page and fill "file description" field.

They talk briefly about the PHP functions that will be used in the tutorial and the concept of using IFRAMEs to handle the content coming in (without reloading the page). The rest of the article is a code dump showing the pieces of (procedural) code to get the job done. There's some commenting, but if you're a new coder to PHP, you might want to check out the main PHP site for some more information on the functions used.

tagged: ajax tutorial asynchronous file upload iframe ajax tutorial asynchronous file upload iframe

Link: