Monthly Archives: April 2010

Alternative control statement for PHP

PHP offers alternative for control statements just for developers who did not want to see lot of curly brackets ‘{ }’ in their code.

//and close it with

It’s also applicable to else statement:

//code here
//code here

This alternative method can also be used for foreach.

BlockUI – a whole web blocker

If we use AJAX to submit the form, sometime it takes time for server to respond to the AJAX request and in this period of time user might move around and click another action. Solution for this problem is; we block the whole web until the request is completed. There is one jQuery plugin for developers to be able doing this called jQuery BlockUI.

The package can be download right here:

The implementation is pretty simple. All we need to include the javascript file and called its function anytime. As for AJAX form request, you can call the $.blockUI(); function before you made a request for example:

$.blockUI(); //start block UI

Facebook Connect integration in simple way

To implement Facebook Connect. First make sure to create the application profile inside Facebook Developer because we will need the API key for our site later on. Complete it and copy the generated API key.

Facebook Connect implementation in web consists of two parts; which it was on header and footer. As for header, you’ll need to insert these two lines of codes.

<html xmlns="" xmlns:fb="">
<script src="" type="text/javascript"></script>

And for footer, apply this code

<script type="text/javascript">
    FB.init("API KEY HERE", "xd_receiver.htm");
    FB.ensureInit(function() {
        if(FB.Connect.get_loggedInUser() != null){
            var param = {action: "facebooklogin", uid: FB.Connect.get_loggedInUser()};
            // ajax request for login
                //if true redirect else register
                if(data == "true"){
                }else if(data == "false"){
                    alert("Technical Error.");