$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
Subscribe to:
Posts (Atom)