Archive

Archive for the ‘Development’ Category

Integrating Zend Framework with Drupal and WordPress

By   | on July 23rd, 2011 No comments

Zend Framework is not only a framework but a robust library for many kind of operations and services. While working with Drupal or WordPress sometime we found that a good library for one particular operation is already available in Zend Framework.

You can easily use Zend Framework library in your projects with bothering about its app framework and MVC structure. Drupal and WordPress both have mechanism to use Zend framework in them without doing any major work.

Drupa module for Zend Framework

Its very easy to setup and use. You can start using Zend Framework in your Drupal modules within few minutes.
Installation and usage instructions are available on Module’s page.

http://drupal.org/project/zend

This module is available for version 6 as well as 7 of Drupal.

WordPress plugin for Zend Framework

http://wordpress.org/extend/plugins/zend-framework

This module also provide embedded Zend framework library and easy to install and setup.

Plugin’s official setup instructions need one clarification (As I am writing this).

On page

http://wordpress.org/extend/plugins/zend-framework/installation/

Following instruction has been mentioned.

1. Upload plugin-name.php to the /wp-content/plugins/ directory

I think writer forgot to change the instruction template, this can be read at

1. Upload zend-framework folder to the /wp-content/plugins/ directory

One more plugin is also available for WordPress at

http://wordpress.org/extend/plugins/wp-zff-zend-framework-full

This module has instructions which are more detailed and precise to be used.

Let�s plug the power of Zend Framework library to these wonderful CMSs and enjoy the benefits.

WordPress to Drupal Migration – Part 1

By   | on August 5th, 2010 No comments

Recently I have done few projects where sites were growing rapidly in terms of functionalities and their current wordpress structure was not good enough to handle those changes. I am going to write about the summary of these personal experiences in this series of articles. I will summarize the steps and work I have done to do this migration.

Why Migration?

We should not do something because we can, should only do if need is there. So before starting it is necessary to understand if you really need the migration from WordPress to Drupal. WordPress is really a fantastic system and I have used the wordpress on website where we have done big customization and those sites were getting users visit in millions.

Following points can be considered and discussed with the team before finalizing migration :-
1. What is main purpose of migration?
2. What are the main problems which you are supposed to solve with migration?
3. Is there any available way in the current system using which current system issues can be solved?
4. What is the time different between estimation of migration and solving problem within current system?
5. do you see any future benefits in migration?
6. Do you have required skill set and resources to do the migration?
7. Are you migrating because you do not have resources to manage current system?

Gather answers for these questions and then analyze your situation.

In next part I will discuss what benefits Drupal can provide over a WordPress system?

PHP Interview Questions

By   | on June 22nd, 2010 No comments

Hi, I have created a page on my this blog named PHP Interview Questions on which I will compile a list of questions which I normally asks to my candidates. I am not worried about leaking my questions strategy as I know only a good person can handle my supplementary questions I asked on the spot.

What you should know in wordpress to be a wordpress programmer?

By   | on February 20th, 2010 No comments

I got several messages that I should point out a list of topics which a developer should know in wordpress to categorize him/her as a wordpress programmer.

“WordPress Programmer” or “WordPress Developer” terms can be new to someone but due its popularity, term is getting attention and several companies are doing hiring based on wordpress experience only.

So in this post I am just enlisting some points which a wordpress programmer should know.

  • How to install wordpress? (Yes it really easy but you should know that :) )
  • How to edit config file of wordpress if needed? You should also know what normally can be edited?
  • How to install a plugin in wordpress?
  • How to install a theme in wordpress?
  • How to modify a them in wordpress?
  • What are page templates?
  • How you can create/use a different template for archive or category page?
  • How you can use widgets?
  • How you can create a plugin?
  • How you can modify the content of a post or page?
  • How you can add something before or after a post/page content?
  • What are filters?
  • What are actions and how you can define callback functions on a particular action?
  • How you can create admin menu using plugins?
  • How you can edit the templates in online editor?
  • How you can manage widgets?
  • How you can manage users and thier different types?
  • How you can disable/enable comments on a wordpress site or on a specific page or post?
  • How you can use OPML files?
  • How you can import RSS feeds?
  • How you create custom meta tags in posts?
  • How you can add specific attributes to any post or page?
  • How you can mange user registration?
  • How you can create private blogs or posts?
  • At least 10-15 different plugins which can enhance/extend the basic wordpress functionality.
  • How you can use caching in wordpress?
  • How to upgrade wordpress?
  • How to take backup of wordpress posts using export?
  • How to take database backup of wordpress? (This can be classifieds as normall database backup process)

Above All

You should know what WordPress CAN not do by default and what we should not try to do with it

WordPress : A PHP Developer’s delight

By   | on January 17th, 2010 No comments

First in the series of my experiments with Open Source CMS, today I will write about my experiments with wordpress as PHP developer.

I heard about wordpress long ago but have used it on large scale since year 2007. I have created some custom setups so different domains can run from same code base. I have also created lots of plugins to handle content customization, displaying different source content like google maps, creating automated posts with different source database, url customizations and lots of things.

I found wordpress very easy to setup, its just few click setup, and in our customization it was just a single click setup for any web site. Creating plugin in very very easy due to its documentation and support for many events and hooks in life cycle of any page.

Different page templates is also one of the great feature of wordpress where you can use different design templates for different pages. I am so impressed with wordpress that I have transferred my this blog to wordpress blog. WordPress is blessing for PHP developers.

PHP Functions to work with PHP functions

By   | on July 9th, 2009 No comments

In this article, I am going to write about the functions using which you can get the information about php functions.

For a full list of PHP functions you can visit http://www.zend.com/phpfunc/

Using these functions you can query the stats/status of your functions, these functions are very useful in dynamic application creation.

For example, using func_get_arg and func_num_args functions you can simulate the function overloading in PHP.

Read a good example for http://www.dubi.org/php-function-overloading

Functions I will write in this article are :-

get_defined_functions();

You want to how many functions are in your installation of PHP, just call this function, it will return an array of all php functions you can call. For the convince it return an multidimensional array, so you can access both internal and user defined functions separately.

func_get_arg()

Returns the argument which is at the arg_num’th offset into a user-defined function’s argument list. Function arguments are counted starting from zero. func_get_arg() will generate a warning if called from outside of a function definition. This function cannot be used directly as a function parameter. Instead, its result may be assigned to a variable, which can then be passed to the function.
If arg_num is greater than the number of arguments actually passed, a warning will be generated and func_get_arg() will return FALSE.
As this function depends on the current scope to determine parameter details, it cannot be used as a function parameter. If you must pass this value, assign the results to a variable, and pass the variable.

func_get_args()

Returns an array in which each element is a copy of the corresponding member of the current user-defined function’s argument list. func_get_args() will generate a warning if called from outside of a function definition. This function cannot be used directly as a function parameter. Instead, its result may be assigned to a variable, which can then be passed to the function.
This function returns a copy of the passed arguments only, and does not account for default (non-passed) arguments.
As this function depends on the current scope to determine parameter details, it cannot be used as a function parameter. If you must pass this value, assign the results to a variable, and pass the variable.

func_num_args() Returns the number of arguments passed into the current user-defined function. func_num_args() will generate a warning if called from outside of a user-defined function. This function cannot be used directly as a function parameter. Instead, its result may be assigned to a variable, which can then be passed to the function.
As func_get_arg() this function also can not be passed as argument to another function.

function_exists()

Checks the list of defined functions, both built-in (internal) and user-defined, for function_name. Returns TRUE on success or FALSE on failure.

create_function()

Creates an anonymous function from the parameters passed, and returns a unique name for it. Usually the args will be passed as a single quote delimited string, and this is also recommended for the code. The reason for using single quoted strings, is to protect the variable names from parsing, otherwise, if you use double quotes there will be a need to escape the variable names, e.g. \$avar.

This is one of very useful function to create dynamic application, using this function you can create the function at run time and then use them as per your requirements.

call_user_func()

Call a user defined function given by the function parameter.
People are divided on the use of this function, some thinks that it is not needed at all when we can run the function on the variable itself.
Like use of this function is

function test($value)
{
print "This is $value";
}

call_user_func("test","test value");

some people prefer using variable function like this :-

$funcname="test";
$funcname("test");

This is also a call_usr_func_array function.

is_callable()

If you are going to use a a variable function like previous example, you may need to verify if a function already present and callable? using this function you can do that.
This function Verify that the contents of a variable can be called as a function. This can check that a simple variable contains the name of a valid function, or that an array contains a properly encoded object and function name.
The var parameter can be either the name of a function stored in a string variable, or an object and the name of a method within the object, like this:

array($SomeObject, 'MethodName')

In some way it is similar to function_exisits function but it does more that that if you just want to check the syntax then you can pass a second argument as True, in that case it only verifies that var might be a function or method. It will only reject simple variables that are not strings, or an array that does not have a valid structure to be used as a callback. The valid ones are supposed to have only 2 entries, the first of which is an object or a string, and the second a string.

PHP is a functional language and you can almost do anything with these functions.

Tags:

PHP Training Education Tutor in Delhi NCR

By   | on June 22nd, 2008 No comments

As PHP is gaining the ground in India, numbers of initial level jobs are also increasing day by day. Almost every day I got questions from new comers how they can learn PHP? Which training institute is providing the training in PHP?

Unfortunately almost all major player of training industry in India, specially Delhi are still not doing much (I should nothing) in this regard.

So I am thinking about organizing PHP training camps in and around Delhi in this summer, If you would like to be in that camp, I would request you for sending a message via my contact us page.

Please give me some details about yourself and in which area of Delhi or NCR you will prefer the camp.


Click here to send your message for PHP training camp.

Tags:

Using SQL abstraction and CRUD factory classes is a good practice?

By   | on July 6th, 2007 No comments

This question again struck me today, somebody just throw a simple question about EXPLAIN statement in MySQL and in hast I relate that to DESCRIBE. When that person cut the line of phone, I suddenly realize my mistake.

I am working with PHP and MySQL since last seven years then why this happen to me? This is because I am not using MySQL frequently, although it is the integral part of almost every application I am working on. I am fairly away from MySQL queries because I am using my factory classes or framework like cakephp which does not require me to write the SQL queries. Almost all of my operations on database are covered within my CRUD classes. Even complex select or updates are possible using simple search objects in my factory classes or framework I am using.

BUT this practice has caused a deficiency in my knowledge of MySQL statements. This situation is really horrible sometime. Do I need to stop using my factory classe practice and abstraction. I normally prefer abstraction and factory classes because I want to make my code portable to other databases also.

I am really a in fix What should I do?
BUT again another question struck me What is more important? My knowledge of MySQL statements or fast and portable execution of projects. When we got the higher level, we certainly miss the lower level details of applications.

So I will stick to my factory classes, because I know I may struggle with some academic questions about MySQL for the time being but at least I can do the stuff with just one reference to MySQL manual. Above all I may face problem in simple MySQL statements but I am good at high level things like replication and performance tuning at server level.

What you say is it a good decision?

Tags: