Adding Facebook Like button to all pages

Adding the Facebook Like button to a page is easy enough visiting this link and generating the code needed. However, things are pretty different when you have a lot of dynamic pages or you want to add it for your whole site in one place, in some file that you include in your whole site . . . → Read More: Adding Facebook Like button to all pages

Single quotations vs double quotations in PHP

Strings in PHP can be specified in four different ways: single quoted, double quoted, heredoc syntax and (since PHP 5.3.0) nowdoc syntax, the first two of them being by far the most frequently used.

When do we use single quotations, when do we use double quotations and which are the differences between them?

Single . . . → Read More: Single quotations vs double quotations in PHP

HTTP or HTTPS, find out if the page is secure in PHP

Any site involving sensitive information needs to have some of its pages only accessible via SSL. This is a way to make sure that your page is only available on https, using the predefined variable $_SERVER['HTTPS'] to determine the connection and $_SERVER['SERVER_NAME'] and $_SERVER['REQUEST_URI'] to rebuild the accessed url:

1 2 3 4 5 if($_SERVER[’HTTPS’] . . . → Read More: HTTP or HTTPS, find out if the page is secure in PHP

Retrieve and display latest tweets

With all this social networking hype, many sites display their latest tweets on their pages. Here’s a simple method to display your latest tweets from PHP:

Let’s assume your twitter username is “mytwittername”. You can retrieve your latest tweets in XML format at the following address:

http://twitter.com/statuses/user_timeline/mytwittername.xml

replacing mytwittername with your username. By default, it . . . → Read More: Retrieve and display latest tweets

PHP tricks to avoid the most common pitfalls

If you just started learning and using PHP I’m pretty sure you started making mistakes too. Some you’ll find easy to spot and to correct, but some will drive you crazy. That is why today I’ll give you some quick tips that may help you avoid torments and frustration.

Syntax errors The syntax errors are . . . → Read More: PHP tricks to avoid the most common pitfalls

Categories

Archives

Calendar

June 2010
M T W T F S S
    Jul »
 123456
78910111213
14151617181920
21222324252627
282930