How to install Drupal using Drush command line?

Installing Drupal using web browser is very hectic process. Every time you want to install new Drupal instance, download the latest Drupal version, copy paste it inside your working directory, open the browser and do etc etc etc...

I have a better solution for this.

If you have installed Drush in your machine then follow the below steps. Otherwise go to my this post and first installed Drush after that continue with this post.

You just need to go to your working directory for example (c:/wamp/www Or c:/xampp/htdocs) using your drush command line interface. Then run these two commands one by one.

This command will download drupal 7 inside your working directory.
Note - Make sure your machine is connected with internet.
drush dl drupal-7.x 

In below command, change "YourMySQLUser" with your Mysql username, "RandomPassword" with your Mysql  password and "YourMySQLDatabase" with your database name.
Note - Make sure your create database before running this command.
drush site-install standard --account-name=admin --account-pass=admin --db-url=mysql://YourMySQLUser:RandomPassword@localhost/YourMySQLDatabase

That's All. Your Drupal installation is completed. You don't even need to open any web browser. Just run these two commands and enjoy :)

How to install drush command line utility on Windows?

Installing Drush command line on Windows is very easy but sometimes it gives these errors such as
"Drush is recognized as internal or external command" Or "Php is not recognized by Drush"

In this situation please follow these steps to setup Drush perfectly on your Machine.

Step 1-
Download the drush from here, unzip it and copy paste it in c drive.

Step 2-
Install the following software's in default c: drive:-
gzip-1.3.12-1-setup(from here)
libarchive-2.4.12-1-setup(from here)
tar-1.13-1-bin(from here)
wget-1.11.4-1-setup(from here)

Step 3-
Download Drush Installer msi file from here
and Install.

Step 4-
Set the environment variable for drush and php location.
1. Go to my computer->Properties->Advanced->Environment Variables.
2. Edit the existing path and paste the following code at the end
   For wamp server -
  ;C:\wamp\bin\php\php5.4.3;C:\drush;C:\ProgramFiles\GnuWin32\bin;
  

   For xampp server -
  ;C:\xampp\php;C:\drush;C:\Program Files\GnuWin32\bin;

Step 5-
Start the drush command line interface and type following command:-
>drush status

You following links to execute Drush commands.

How to implement Facebook Like funtionality in drupal?

There are two ways to implement Facebook likes functionality in your project.

1. First of all it requires a Facebook Url for which you want to display likes count.
    Example:- www.facebook.com/xyz  //Here xyz could be anything.

2. If you want like count numbers with like button in your website then you need to get code from here. Provide the Url(Ex. www.facebook.com/xyz) and select other options as par your requirement.

3. Now Click get code.You will get 2 codes. First one is the Java-script code. You need to put this code in your html head tag.

4. The other code you need to put wherever you want to display like button and its count.

The requirement which I got to implement Facebook like functionality was bit different. I wanted to display only Facebook like count, and not to display like button. For this I have these solutions:-

1. You should use FQL(Facebook Query Language) here. Use the following code:-
https://api.facebook.com/method/fql.query?query=select like_count from link_stat where
url = “http://www.facebook.com/xyz”    // Change this Url

2. Pass this Url inside drupal_http_request() function and use json_decode() to get the value of like count. Then display it wherever you want.

3.You can get the like count by using this code also.
https://graph.facebook.com/?id=your_fb_page_id  // This id should be your page id in Facebook

4. Pass this Url inside drupal_http_request() function and use json_decode() to get the value of like count. Then display it wherever you want.