$custom_theme;
Change active default themes
$base_path;
Tell the cuurent base path
$base_url;
Tell the site url
$db_type;
Tells active Database type
$theme_path;
Tells the current theme path
$language;
Tells the active language
$user;
List has obj of user details
These are most often used global variable in drupal.
This is my set of probable drupal interview questions asked by interviewers
Friday, December 31, 2010
Tuesday, December 14, 2010
How to alter an form?
hook_form_alter(&$form, &$form_state, $form_id)
put an if condition for form id & based on that write the code.
hook_form_FORM_ID_alter(&$form, &$form_state)
put an if condition for form id & based on that write the code.
hook_form_FORM_ID_alter(&$form, &$form_state)
How to do operation on form submit,delete,update?
In any custom module file you have write an hook_nodeapi to do this "hook" is your module name
function hook_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
switch ($op) {
case 'presave':
break;
case 'insert':
case 'update':
case 'view':
case 'delete':
}
}
function hook_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
switch ($op) {
case 'presave':
break;
case 'insert':
case 'update':
case 'view':
case 'delete':
}
}
What is the default storage engine for database in drupal 6 & 7?
In drupal 6 default storage engine is MyISAM
In drupal 7 default storage engine is INNODB
In drupal 7 default storage engine is INNODB
Difference between MYISAM & INNODB?
MYISAM
Table level locking
Used only for large content database like newspaper portal,entertainment portal
INNODB
Row level locking
Used mostly for transaction based website.
this has query like rollback,commit,start transaction.
Table level locking
Used only for large content database like newspaper portal,entertainment portal
INNODB
Row level locking
Used mostly for transaction based website.
this has query like rollback,commit,start transaction.
Where does mysql connection occur in drupal6?
In the includes folder there is an inc file database.mysql.inc in this inc file function called db_connect in this function database connection is intiated.
Where does mysql connection occur in drupal7?
Drupal7 has used PDO for database connection .PDO is noting but PHP data objects.
PDO is a PHP extension to formalise PHP's database connections by creating a uniform interface. This allows developers to create code which is portable across many databases and platforms. PDO is _not_ just another abstraction layer like PearDB although PearDB may use PDO as a backend. Those of you familiar with Perls DBI may find the syntax disturbingly familiar.
PDO is a PHP extension to formalise PHP's database connections by creating a uniform interface. This allows developers to create code which is portable across many databases and platforms. PDO is _not_ just another abstraction layer like PearDB although PearDB may use PDO as a backend. Those of you familiar with Perls DBI may find the syntax disturbingly familiar.
What databases does PDO support?
PDO supports many of the popular databases as seen on the list below.
DBLIB: FreeTDS / Microsoft SQL Server / Sybase
Firebird (http://firebird.sourceforge.net/): Firebird/Interbase 6
IBM (IBM DB2)
INFORMIX - IBM Informix Dynamic Server
MYSQL (http://www.mysql.com/): MySQL 3.x/4.0
OCI (http://www.oracle.com): Oracle Call Interface
ODBC: ODBC v3 (IBM DB2 and unixODBC)
PGSQL (http://www.postgresql.org/): PostgreSQL
SQLITE (http://sqlite.org/): SQLite 3.x
DBLIB: FreeTDS / Microsoft SQL Server / Sybase
Firebird (http://firebird.sourceforge.net/): Firebird/Interbase 6
IBM (IBM DB2)
INFORMIX - IBM Informix Dynamic Server
MYSQL (http://www.mysql.com/): MySQL 3.x/4.0
OCI (http://www.oracle.com): Oracle Call Interface
ODBC: ODBC v3 (IBM DB2 and unixODBC)
PGSQL (http://www.postgresql.org/): PostgreSQL
SQLITE (http://sqlite.org/): SQLite 3.x
What is the hook?
Allow modules to interact with the Drupal core.
Drupal's module system is based on the concept of "hooks". A hook is a PHP function that is named foo_bar(), where "foo" is the name of the module (whose filename is thus foo.module) and "bar" is the name of the hook. Each hook has a defined set of parameters and a specified result type.
Drupal's module system is based on the concept of "hooks". A hook is a PHP function that is named foo_bar(), where "foo" is the name of the module (whose filename is thus foo.module) and "bar" is the name of the hook. Each hook has a defined set of parameters and a specified result type.
Name some of the hook you mostly used?
hook_menu
hook_perm
hook_help
hook_form_alter
hook_nodeapi
hook_load
hook_init
hook_validate
I have listed most commonluy used hook of drupal.
Better choose which you are very clear in it.
hook_perm
hook_help
hook_form_alter
hook_nodeapi
hook_load
hook_init
hook_validate
I have listed most commonluy used hook of drupal.
Better choose which you are very clear in it.
How to place blocks anywhere on the site?
$block = module_invoke('event', 'block', 'view', 1);
print $block['content'];
?>
print $block['content'];
?>
What is module_invoke?
Invoke a hook in a particular module.
eg.
$block = module_invoke('event', 'block', 'view', 1);
print $block['content'];
?>
eg.
$block = module_invoke('event', 'block', 'view', 1);
print $block['content'];
?>
Sunday, December 12, 2010
What is a Module in drupal ?
A module is software (code) that extends Drupal features and/or functionality. Core modules are those included with the main download of Drupal, and you can turn on their functionality without installing additional software. Contributed modules are downloaded from the Modules download section of drupal.org, and installed within your Drupal installation. You can also create your own modules; this requires a thorough understanding of Drupal, PHP programming, and Drupal's module API.
What is PDO?
Drupal7 has used PDO for database connection .PDO is noting but PHP data objects.
PDO is a PHP extension to formalise PHP's database connections by creating a uniform interface. This allows developers to create code which is portable across many databases and platforms. PDO is _not_ just another abstraction layer like PearDB although PearDB may use PDO as a backend. Those of you familiar with Perls DBI may find the syntax disturbingly familiar.
PDO supports many of the popular databases as seen on the list below.
DBLIB: FreeTDS / Microsoft SQL Server / Sybase
Firebird (http://firebird.sourceforge.net/): Firebird/Interbase 6
IBM (IBM DB2)
INFORMIX - IBM Informix Dynamic Server
MYSQL (http://www.mysql.com/): MySQL 3.x/4.0
OCI (http://www.oracle.com): Oracle Call Interface
ODBC: ODBC v3 (IBM DB2 and unixODBC)
PGSQL (http://www.postgresql.org/): PostgreSQL
SQLITE (http://sqlite.org/): SQLite 3.x
PDO is a PHP extension to formalise PHP's database connections by creating a uniform interface. This allows developers to create code which is portable across many databases and platforms. PDO is _not_ just another abstraction layer like PearDB although PearDB may use PDO as a backend. Those of you familiar with Perls DBI may find the syntax disturbingly familiar.
PDO supports many of the popular databases as seen on the list below.
DBLIB: FreeTDS / Microsoft SQL Server / Sybase
Firebird (http://firebird.sourceforge.net/): Firebird/Interbase 6
IBM (IBM DB2)
INFORMIX - IBM Informix Dynamic Server
MYSQL (http://www.mysql.com/): MySQL 3.x/4.0
OCI (http://www.oracle.com): Oracle Call Interface
ODBC: ODBC v3 (IBM DB2 and unixODBC)
PGSQL (http://www.postgresql.org/): PostgreSQL
SQLITE (http://sqlite.org/): SQLite 3.x
Explain the concept of node in drupal.?
A node in Drupal is the generic term for a piece of content on your web site. (Note that the choice of the word "node" is not meant in the mathematical sense as part of a network.) Some examples of nodes:
• Pages in books
• Discussion topics in forums
• Entries in blogs
• News article stories
Each node on your site has a Content Type. It also has a Node ID, a Title, a creation date, an author (a user on the site), a Body (which may be ignored/omitted for some content types), and some other properties. By using modules such as the contributed Content Construction Kit (CCK) module, the core Taxonomy module, and the contributed Location module, you can add fields and other properties to your nodes.
• Pages in books
• Discussion topics in forums
• Entries in blogs
• News article stories
Each node on your site has a Content Type. It also has a Node ID, a Title, a creation date, an author (a user on the site), a Body (which may be ignored/omitted for some content types), and some other properties. By using modules such as the contributed Content Construction Kit (CCK) module, the core Taxonomy module, and the contributed Location module, you can add fields and other properties to your nodes.
Can I use Drupal on the command line?
drush is a command line shell and Unix scripting interface for Drupal
What are hooks in Drupal ?
Allow modules to interact with the Drupal core.
Drupal's module system is based on the concept of "hooks". A hook is a PHP function that is named foo_bar(), where "foo" is the name of the module (whose filename is thus foo.module) and "bar" is the name of the hook. Each hook has a defined set of parameters and a specified result type.
To extend Drupal, a module need simply implement a hook. When Drupal wishes to allow intervention from modules, it determines which modules implement a hook and calls that hook in all enabled modules that implement it.
Drupal's module system is based on the concept of "hooks". A hook is a PHP function that is named foo_bar(), where "foo" is the name of the module (whose filename is thus foo.module) and "bar" is the name of the hook. Each hook has a defined set of parameters and a specified result type.
To extend Drupal, a module need simply implement a hook. When Drupal wishes to allow intervention from modules, it determines which modules implement a hook and calls that hook in all enabled modules that implement it.
what are the SEO modules available in Drupal ?
1. Pathauto
2. Nodewords/ Meta tags
3. Service links
4. Google analytics
5. Related Links
6. Search 404
7. Site map
8. Url list
2. Nodewords/ Meta tags
3. Service links
4. Google analytics
5. Related Links
6. Search 404
7. Site map
8. Url list
How to enable clean urls in drupal ?
The standard Drupal installation contains a sample .htaccess file which supports clean URLs. It is easy to miss copying this file, because of the leading "dot". So before trying to enable Clean URLs, make sure this file exists in your Drupal installation.
Drupal 6.x
In Drupal 6, the installer tests for compatibility with Clean URLs as a part of the installation process.
Drupal 5.x
Goto the administer >> site configuration >> clean urls section of the administrative interface.
Clean urls can be enabled by following the above two options in respective versions of drupal website.
Drupal 6.x
In Drupal 6, the installer tests for compatibility with Clean URLs as a part of the installation process.
Drupal 5.x
Goto the administer >> site configuration >> clean urls section of the administrative interface.
Clean urls can be enabled by following the above two options in respective versions of drupal website.
How theme an node of an particular content type page?
Create node-contenttypename.tpl.php in theme folder & clear the cache
How theme an particular content type page?
create page-contentypename.tpl.php in theme folder & clear the cache
How to add region in drupal 5 & 6?
Add region in drupal5
---------------------
function mytheme_regions() {
return array(
'right' => t('right sidebar'),
'content' => t('content'),
'header' => t('header'),
'footer' => t('footer'),
'floater' => t('floater'),
'inline1' => t('inline 1')
);
}
?>
add this code in template.php
Add region in drupal6
---------------------
You gave to declare the region in info file inside the theme folder
regions[regionname] = Region name
---------------------
function mytheme_regions() {
return array(
'right' => t('right sidebar'),
'content' => t('content'),
'header' => t('header'),
'footer' => t('footer'),
'floater' => t('floater'),
'inline1' => t('inline 1')
);
}
?>
add this code in template.php
Add region in drupal6
---------------------
You gave to declare the region in info file inside the theme folder
regions[regionname] = Region name
Tuesday, November 30, 2010
How to assign an theme for an particular callback?
In template.php you have to write a function mytheme_proprocess_page() in tha page you have to write the code below
function theme_preprocces_page(&$vars){
if(arg(0)=='test')
$vars['template-file']= 'page-test';
}
function theme_preprocces_page(&$vars){
if(arg(0)=='test')
$vars['template-file']= 'page-test';
}
Whats new in drupal 7?
1.Better user interface for administrator & users
2.Dashboard menu for administrator to display some important content on login of administrator. it is more often configurable.
3.IP Address blocking configuration is provided.
4.CCK,imagecache & URL alias is in built in Drupal.
5.Naming convention are changed in drupal for eg.Themes are represented as Appearance & User links are represented as people.
6.Module list page itself contains the link to its permission & Configuration.
7.Upload module in user interface itself .Module list page has provision to upload an module folder in an specified format.
8.All files in the module other than module file must be declared in the info file of that module.
9.If the module uses any admin configuration then the configuration path must be declared in the info file
2.Dashboard menu for administrator to display some important content on login of administrator. it is more often configurable.
3.IP Address blocking configuration is provided.
4.CCK,imagecache & URL alias is in built in Drupal.
5.Naming convention are changed in drupal for eg.Themes are represented as Appearance & User links are represented as people.
6.Module list page itself contains the link to its permission & Configuration.
7.Upload module in user interface itself .Module list page has provision to upload an module folder in an specified format.
8.All files in the module other than module file must be declared in the info file of that module.
9.If the module uses any admin configuration then the configuration path must be declared in the info file
What are the advantages & disadvantages of using drupal?
Advantages of the Drupal way of doing things:
1. It's consistent. For example, if you always use the "correct" way to print out usernames, changing the style of those printed usernames in one place changes them across the entire site.
2. It's integrated.
3. It's convenient.
But there are some disadvantages:
1. It's slow(er).
2. It uses memory.
1. It's consistent. For example, if you always use the "correct" way to print out usernames, changing the style of those printed usernames in one place changes them across the entire site.
2. It's integrated.
3. It's convenient.
But there are some disadvantages:
1. It's slow(er).
2. It uses memory.
Monday, November 29, 2010
What is MVC architechture
I will explain this based on drupal
MVC means MODEL VIEW CONTROLLER
Controller
Controller receive input from user and tells the model & view to perform the input & get that response from it & displays.For example.In drupal index.php is the controller
View
It is an user interface element.Makes the model more intractable with user.For example. themes in drupal is considered as view.
Model
Manages data & behavior of the domain.It responds to the request from controller.
For example.Modules & database comes under the model
MVC means MODEL VIEW CONTROLLER
Controller
Controller receive input from user and tells the model & view to perform the input & get that response from it & displays.For example.In drupal index.php is the controller
View
It is an user interface element.Makes the model more intractable with user.For example. themes in drupal is considered as view.
Model
Manages data & behavior of the domain.It responds to the request from controller.
For example.Modules & database comes under the model
How does drupal works?
1. In htacces file index.php page will be mentioned as first processing page of drupal.
2.In index.php bootstrap.inc file has been included which is core part of drupal
3.Then a function menu_execute_active_handler() is called
4.In the above function will check whether any call back is there at address bar else it will get the default call back defined in drupal.
5.menu_execute_active_handler() WILL also check whether there is any access denied for this callback,site is offline,callback not found.
6.Drupal will process this callback return the page content in string.
7.Then Drupal theme the string content by calling theme_page function
8.drupal_page_footer() is called to display the footer content
2.In index.php bootstrap.inc file has been included which is core part of drupal
3.Then a function menu_execute_active_handler() is called
4.In the above function will check whether any call back is there at address bar else it will get the default call back defined in drupal.
5.menu_execute_active_handler() WILL also check whether there is any access denied for this callback,site is offline,callback not found.
6.Drupal will process this callback return the page content in string.
7.Then Drupal theme the string content by calling theme_page function
8.drupal_page_footer() is called to display the footer content
Friday, November 26, 2010
How can we open a popup when browser is popups blocked
You can use the popups module in drupal to lead any content in popup in drupal 7 they have introduced overlay module.
This overlay module makes the content of all drupal administrator menu to be displayed in dialog box.
Other that this i am not much sure about about this module,but soon i will tell you about this module
This overlay module makes the content of all drupal administrator menu to be displayed in dialog box.
Other that this i am not much sure about about this module,but soon i will tell you about this module
What is the latest version of drupal 5 & 6?
U may think silly about this question ,but of course it is an important thing.
Drupal 6 : 6.19*
Drupal 5 : 5.22*
Drupal5 wont be maintained on release of Drupal7
*Version may change please check http://drupal.org once
Drupal 6 : 6.19*
Drupal 5 : 5.22*
Drupal5 wont be maintained on release of Drupal7
*Version may change please check http://drupal.org once
Why is drupal is widely used for cms?
Use Drupal to build everything from personal blogs to enterprise applications. Thousands of add-on modules and designs let you build any site you can imagine.
Drupal is free, flexible, robust and constantly being improved by hundreds of thousands of passionate people from all over the world.
Drupal is free, flexible, robust and constantly being improved by hundreds of thousands of passionate people from all over the world.
Whats new in drupal7?
Usablity
1.Better User Interface for administrator sine there is page loading instead they have user dialog box.
2.Dashboard Menu introduced so that administrator which have important content in that dashboard eg. who's online,List Recent post so that administrator can approve which is configurable.
3.CCKS,Image cache & Url alias module is inbuilt in drupal7
4.They have changed the title of some of the administrator Configuration
5.All the files used in an module folder must be defined in info file
6.More secure implementation for scheduled tasks (cron.php).
7.Module can be updated via web interface
Database
1.Added query builders for INSERT, UPDATE, DELETE, MERGE, and SELECT queries.
Support for master/slave replication, transactions, multi-insert queries,delayed inserts, and other features.
2.Added support for the SQLite database engine.
3.Default to InnoDB engine, rather than MyISAM, on MySQL when available for greater scalability and data integrity.
JavaScript changes
1.Upgraded the core JavaScript library to jQuery version 1.4.2.
2.Upgraded the jQuery Forms library to 2.36.
3.Added jQuery UI 1.8, which allows improvements to Drupal's user experience.
1.Better User Interface for administrator sine there is page loading instead they have user dialog box.
2.Dashboard Menu introduced so that administrator which have important content in that dashboard eg. who's online,List Recent post so that administrator can approve which is configurable.
3.CCKS,Image cache & Url alias module is inbuilt in drupal7
4.They have changed the title of some of the administrator Configuration
5.All the files used in an module folder must be defined in info file
6.More secure implementation for scheduled tasks (cron.php).
7.Module can be updated via web interface
Database
1.Added query builders for INSERT, UPDATE, DELETE, MERGE, and SELECT queries.
Support for master/slave replication, transactions, multi-insert queries,delayed inserts, and other features.
2.Added support for the SQLite database engine.
3.Default to InnoDB engine, rather than MyISAM, on MySQL when available for greater scalability and data integrity.
JavaScript changes
1.Upgraded the core JavaScript library to jQuery version 1.4.2.
2.Upgraded the jQuery Forms library to 2.36.
3.Added jQuery UI 1.8, which allows improvements to Drupal's user experience.
Subscribe to:
Posts (Atom)