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/

Brian Swan's Blog:
Streaming Silverlight Video with PHP
Mar 31, 2010 @ 08:45:52

In a new post to his MSDN blog today Brian Swan looks at combining PHP with Silverlight to make it simpler to embed streaming content into your sites.

I’d planned on diving into the Embedding Silverlight in PHP project, but what I found is that there have been some changes in Microsoft technologies since the release of that project that make it even easier to embed Silverlight in PHP applications. So I'll stick to the spirit of my promise if not to the letter of it.

He shows how to set up some storage (a blob) on the Windows Azure service as a place to keep the video you're going to stream. When you set it up you'll create a public service name and get an access key that you can use when accessing the videos. He includes an example of the upload process and how, based on the information for each video, you can use this project to pull video directly from this data store.

tagged: silverlight embed tutorial azure windows

Link:

phpPro.org:
Embedding PHP In CSS
Apr 13, 2009 @ 12:05:52

New on the phpPro site is this article looking at a technique for embedding PHP inside of your CSS files and have it correctly interpreted.

Perhaps one of the most frustrating aspects of using PHP with websites, is getting variables into CSS. Having variables stored in an ini file, config file or even a database can make the updating of the look and feel of a site simple, however, CSS files, by default, do not parse PHP. [...] A html file may also include a PHP file, in the same manner as it includes a CSS file. This means the stylesheet can be renamed from style.css to style.php.

Using this method, the PHP inside the file is parsed and, because its included with a link tag, the CSS is also made available to the rest of the page.

tagged: embed css link parse webserver

Link:

Stefan Koopmanschap's Blog:
Distributing your project with symfony embedded
Oct 13, 2008 @ 12:57:51

Stefan Koopmanschap has a recent post to his blog showing how to embed a distribution of the symfony framework in with the release of your application:

With symfony 1.0, one of the nice features was the freeze option, which allowed you to package the symfony libraries inside your project quite easily. This was very useful, for instance when deploying your project on a server where you couldn't install symfony. With symfony 1.1, it is apparently not advised anymore to use the freeze option (even though it is still available). So how should this be done then? Let's have a look...

He steps through the process, first setting up a subversion repository then putting a copy of symfony in to the lib/vendor directory and use the svn:externals to link to it.

tagged: symfony framework distribute embed subversion svn externals

Link:

Facebook.com:
PHPEmbed
Oct 23, 2007 @ 10:27:00

Facebook application developers who already know PHP can be happy about a recent announcement on their blog - the introduction of PHPEmbed library into their setup (as well as a release of it out to the public).

In order to make embedding PHP truly simple for all of our developers we developed the PHPEmbed library which is just a more accessible and simplified API built on top of the PHP SAPI. The library is so useful, we decided to share it with the world. Check it out for yourself at http://developers.facebook.com/phpembed/

The library (currently in release 20070924) can be grabbed either directly from their download link or via the public svn repository they've set up. There's also some documentation and help for it in the form of a developer's group and the manual (PDF/HTML).

tagged: phpembed facebook sapi embed library project phpembed facebook sapi embed library project

Link:

Facebook.com:
PHPEmbed
Oct 23, 2007 @ 10:27:00

Facebook application developers who already know PHP can be happy about a recent announcement on their blog - the introduction of PHPEmbed library into their setup (as well as a release of it out to the public).

In order to make embedding PHP truly simple for all of our developers we developed the PHPEmbed library which is just a more accessible and simplified API built on top of the PHP SAPI. The library is so useful, we decided to share it with the world. Check it out for yourself at http://developers.facebook.com/phpembed/

The library (currently in release 20070924) can be grabbed either directly from their download link or via the public svn repository they've set up. There's also some documentation and help for it in the form of a developer's group and the manual (PDF/HTML).

tagged: phpembed facebook sapi embed library project phpembed facebook sapi embed library project

Link:

Builder.com.au:
PHP exploit code plants itself in GIF
Jun 22, 2007 @ 12:41:00

Builder.com.au has a new article today about the recent image issue - the PHP code embedded inside the GIF - that's come up on several sites.

The exploit code slipped through the site's defenses with the aid of a legitimate image at the beginning of the file, according to a blog post on the Sans Institutes's Internet Storm Center. [...] Malicious attackers planted PHP coded exploit script within an image file. PHP is often used as a programming language to create dynamic Web sites.

The article reports that, while this exploit hasn't happened much, the occurrences of it's use are growing with victims in a wide range of classifications - from small personal sites out to a certain major image hosting site. This same issue was discussed here on the PHPClasses.org website as well.

tagged: gif exploit image script embed gif exploit image script embed

Link:

Builder.com.au:
PHP exploit code plants itself in GIF
Jun 22, 2007 @ 12:41:00

Builder.com.au has a new article today about the recent image issue - the PHP code embedded inside the GIF - that's come up on several sites.

The exploit code slipped through the site's defenses with the aid of a legitimate image at the beginning of the file, according to a blog post on the Sans Institutes's Internet Storm Center. [...] Malicious attackers planted PHP coded exploit script within an image file. PHP is often used as a programming language to create dynamic Web sites.

The article reports that, while this exploit hasn't happened much, the occurrences of it's use are growing with victims in a wide range of classifications - from small personal sites out to a certain major image hosting site. This same issue was discussed here on the PHPClasses.org website as well.

tagged: gif exploit image script embed gif exploit image script embed

Link:

PHPBuilder.com:
Unstoppable Return Receipt Requested Email with PHP
May 04, 2007 @ 10:30:00

PHPBuilder.com has a new article today that shows how to (almost always) know if someone has read an email you've sent or not via a special sort of return receipt request.

The problem is that depending on the email client software that your recipient is using, he or she will most likely be given the option to suppress that return-receipt from being sent back to you. This renders the return-receipt system almost completely unreliable as a means of detecting when someone has read your email. If you have access to a web server that's running PHP, you can make your own return-receipt system that is (almost) guaranteed to work.

Their method is to embed an image into the email's content. This image is actually a linked image generated by PHP making it able to grab information about the view status of the email it's included in.

tagged: return reciept email image embed link return reciept email image embed link

Link:

PHPBuilder.com:
Unstoppable Return Receipt Requested Email with PHP
May 04, 2007 @ 10:30:00

PHPBuilder.com has a new article today that shows how to (almost always) know if someone has read an email you've sent or not via a special sort of return receipt request.

The problem is that depending on the email client software that your recipient is using, he or she will most likely be given the option to suppress that return-receipt from being sent back to you. This renders the return-receipt system almost completely unreliable as a means of detecting when someone has read your email. If you have access to a web server that's running PHP, you can make your own return-receipt system that is (almost) guaranteed to work.

Their method is to embed an image into the email's content. This image is actually a linked image generated by PHP making it able to grab information about the view status of the email it's included in.

tagged: return reciept email image embed link return reciept email image embed link

Link: