Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds

Integrating phpList 2 with Facebook

Save for later
  • 3 min read
  • 02 Aug 2011

article-image

 

PHPList 2 E-mail Campaign Manager

Prerequisites


For this section, we'll make the following assumptions:

Preparing phpList


Facebook allows us to include any content on our page in an iframe with a maximum width of 520 px. phpList's default theming won't fit in 520 px and so it will either get cut off and look odd, or will invoke awkward scroll bars in the middle of the page.

To resolve this, we'll need to change the styling of phpList. Note that this will also affect how the public URLs to our phpList site are displayed outside of Facebook (that is, the default sign up page).

Navigate to the configure page in phpList's admin interface, using the right-hand navigation panel:

integrating-phplist-2-facebook-img-0


Scroll down to the section starting with Header of public pages and click on edit. This is the HTML code that is added to the top of every public (not admin) page.

integrating-phplist-2-facebook-img-1


In the following example, we've removed the background image, the HTML table, and images, but left the CSS styling unchanged:

integrating-phplist-2-facebook-img-2


Having saved your changes, edit the next section labeled Footer of public pages and make the corresponding changes:

integrating-phplist-2-facebook-img-3


Remember that the actual content that the user sees will be "sandwiched" between the header and footer. This means that if you open a tag in the header, you need to make sure it's closed again in the footer.

Again in this example, we just closed the HTML body tag in the footer:

integrating-phplist-2-facebook-img-4


Having changed the header and footer of the public pages, browse to your default public page (http://your-site.com/lists/, for example) to see how the page looks:

integrating-phplist-2-facebook-img-5


Note that there is hardly any styling now, but that there are no fixed-width elements which will cause issues with our iframe. Tweaking the design of using the public header and footer code is a task left to the reader.

Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at €14.99/month. Cancel anytime

Creating the Facebook app


Before we can add phpList to our Facebook page, we need to create an App.

From http://www.facebook.com/developers/, click on the Set Up New App button:

integrating-phplist-2-facebook-img-6


Click the radio button to indicate that you agree to the Facebook terms and then click on Create App:

integrating-phplist-2-facebook-img-7


Prove you're a human by completing the CAPTCHA:

integrating-phplist-2-facebook-img-8


You're taken to the edit page for your new app. Under the Facebook Integration section, enter at least the following details:

  • IFrame Size: Auto-resize (we don't want scrollbars)
  • Tab Name (what the tab will be called when your page is displayed)
  • Tab URL (the full URL to the page you want loaded in your iframe. Generally, this would be a phpList subscribe page)

integrating-phplist-2-facebook-img-9


Once you've saved your changes, you're taken to your list of applications. Click on Application Profile Page to see the application as other Facebook users would see it (as opposed to the developer):

integrating-phplist-2-facebook-img-10


On the application's profile page, click on Add to My Page to add this application to your Facebook page:

integrating-phplist-2-facebook-img-11


When prompted, choose which of your pages you want to add the application to. In this example, we've created a page for this article, so we add the application to this page:

integrating-phplist-2-facebook-img-12