Sunday, November 21, 2010

Steps to start a Drupal Project

Drupal needs a minimal configuration during set up. Drupal comes in a tar.gz compressed file available in First you have to decompress the files and copy them into your webserver. Also create a database in mysql using phpmyadmin or any other DBA tool. Make sure you have mysql username and password ready to begin the installation. After copying the extracted drupal files, Open your browser and run the index.php page of your drupal installation folder. If your server is localhost and you have copied drupal files inside the fodler called "drupaltest", then go to the browser and open "http://localhost/drupaltest/" . The installation screen will be visible. Follow the procedures to enter database details and username and password. Also create a folder named "files" inside sites/default/ and make sure that it is writable by the webserver. By clicking the next button, drupal will be automatically installed and will prompt you for admin email and login password for superuser. Enter them and voila!, Drupal has been installed in your webserver and you are ready to go.

For more explanation see this video, this might help you to start with Drupal:

Wednesday, November 17, 2010

Basic PHP knowledge for Drupal - Part 4

4. Arrays: PHP arrays are widely used in drupal for internal coding. Drupal API has enough application of php arrays so one have to understand php array operations for drupal development. Arrays are defined as a variable which holds multiple similar types of data , i.e strings, integers etc. The syntax for php array are listed below,

$a = array('cat','dog','cow');  // String type array
$b = array(1,2,35,6,7); // Integer type array

Arrays can hold any number of elements and php have multiple array functions to perform several operations over them. Please refer to the for array reference.

See this video for more details about PHP arrays.

Another Video for more details about arrays,

Tomorrow I will write about the procedure to start a Drupal Development Task.

Sunday, November 7, 2010

Basic PHP knowledge for Drupal - Part 3

2. Functions in PHP: Functions are a block of code where operations and functionalities are defined in one place and called from another place. Thus one can perform a task without writing the same code again. Every function returns a value, it may be an integer, string or boolean etc. Functions must be defined in the included files or scripts to use them. Here goes an example of simple functions which takes 3 numbers, first two numbers are added and then multiplied with the third number.

Function definition:
function foo($a,$b,$c){
$result = ($a+$b) * $c;
return $result;

Here $a,$b,$c are called argument signatures. they are just the replica of the parameter which is put as the argument during function call. Functions can be called by value or called by reference. In case of call by reference, function does not need to return anything as in this case modification occurs inside the passed variables (argument).

Function Usage:
echo foo(1,2,3);

The output would be 9.

echo foo(3,2,3);
The output would be 15.

Though there are lot of functions and more complex in nature defined in Drupal API. Don't worry, you don't have to remember all the function names. By doing drupal projects you will automatically remember those useful function names. For other unknown functions, just go to to get the documentation of all the defined function in Drupal API.

For more reference about PHP functions read this link.

Saturday, November 6, 2010

Basic PHP knowledge for Drupal - Part 2

As per the previous section, five key part of PHP knowledge os necessary to start drupal development.

1. PHP variables: These are represented as $variablename , Also there are certain conventions about variable names like you cannot put "-" in it or you cannot start  with a number like $34abc etc.
Allowable syntaxes are: $var, $var123, $var_12, $var_abc etc. Generally variables are written in lower cases, in certain cases they can be written in Camel Cased ($VarName etc). It is good to practice meaningful variable names while writing code as it prevents confusion among the different programmers.

These variables hold the value required for the programming during php execution. There are also centain types of variable depending upon the content of the variable.

Integer type variable: $var = 1;
Float type variable: $var = 2.33;
String type variable: $var = 'Hello World';
Boolean type variable: $var = true;

These are the four major variable types used widely in drupal coding. You can also assign one variable's value to another variable.

e.g $var1 is a Integer type variable.

$var1 = 5;
$var2 = $var1;

Here $var2 will get the value of $var1 which is 5.

The most exciting feature of PHP variable is automatic type casting. Data types can be converted into any types without type casting.
$var1 = "5";
$var2 = 5;

These two variables will be treated as same while code execution, though one is integer and another is string.

In the next chapter I will be telling about functions and their usages.

Basic PHP knowledge for Drupal

Drupal is build up on PHP script. hence it is necessary to understand some basic PHP syntax to start with drupal. Though PHP has a large domain and obviously it is quite hard to cover it in a sinble blog post. So I am mentioning some essential parts of PHP that is required for a basic drupal development. If you are non-developer, this will help you to understand drupal well.

The 5 topics are required to understand in PHP for drupal as they are used elsewhere in drupal codebase. They are as follows.

1. PHP Variables
2. Condition and Loops
3. Functions
4. Arrays
5. Class and Object concept.

Generally PHP scripts has an extention .php, however in drupal codes can be written using any extensions like .module, .inc etc. But scripting inside these files follows the php syntax and its rules. PHP script starts with <?php tag but usually does not require to end with a ?> . The reason behind this is in any open source package (Drupal, Joomla etc.) in PHP, there are lots of files which are included in execution time. As PHP is an interpreted language, PHP parser processes the internal script between <?php and ?> If accidentally any html markup appears between two subsequent <?php tags, PHP parser also processes them. This slows down the execution speed and also there is a chance to get unnecessary whitespaces and characters in the output. So ?> tag is not required for any scripting page in drupal. That ensures that only pure php script is processed by PHP parser, not HTML markup.

Each php statement ends with ";" make sure to give this after every statement in the code.

In the next post I will discuss about the upper-mentioned five topics in details so that you can get an idea about PHP scripting methods and its syntaxes to start up drupal development.

Friday, November 5, 2010


Drupal is today's most powerful yet simple to use open source content management system in the web world. Day after day, by releasing Drupal's new avatar D7, possibilities are endless with this rock solid content management system. Obviously to be a webmaster of a drupal driven website, some knowledge of drupal administration is required. However I have created this blog to spread the words of drupal's philosophy and give the people a little bit of knowledge which I have gathered in my 6 years Web development Experience.

Though it is assumed that, this blog readers have some basic knowledge of PHP syntax, I will quickly overview some topics about PHP scripting language in first few chapters. I write this blog in regular basis. So if anyone follows my writing, I am sure that he will definitely be able to develop websites using drupal within few weeks. It is just fun and you need time and patient to learn step by step methods and hidden secrets which will enable you to develop a drupal site quickly.

I hope you will enjoy the tutorial and I will try to illustrate the drupal architecture from the basic so that you do not need to worry about PHP script if you do not know about it. Start with the first chapter with PHP basics. People who knows php can skip chapter 1,2,3 and start from chapter 4 to learn drupal.

Thanks for reading, have a good time.