Drupal interview questions and answers.
1. Why do you think Drupal is powerful & popular CMS compare to others?
Drupal Allows to create multiple content types using content construction kit (cck) without any programming skills. Also allows customize theme template for each content type. For example you can have page, article , story, slideshow content type.
Related Reading on DGlobaltech.com
Drupal Interview questions : Omega Responsive theme tutorial
HTML5 Interview Questions and Answers : 10 commonly asked questions
Using drupal “URL Settings” and “Pathauto modules, user can have seo friendly urls for the site.
Taxonomy Terms are the most powerful keywords hierarchy, which provides category based organized information. For example – for politics – you can have articles under “Fiscal cliff”, “election”.
Drupal has most powerful search system than other cms application. Also, Drupal provides many opensource ready to use modules to customize website as per requirement without any programming knowledge. All, these points make “Drupal” as popular CMS.
2. What makes “Search” in drupal as an excellent feature than Other CMS?
Drupal uses search indexing using content type, classification information from taxonomy system and the content meta data.
Drupal treats its content as fine-grained semantic information that Drupal knows about can be used to fine-tune search results.
Also, you can tweak and override the search system to adjust the user interface, the way content is ranked, and the way results are displayed. That said, Drupal integrates well with external search engines such as Apache Solr, Xapian, and Sphinx if the built-in search does not meet your needs very easily.
3. What is a Module in drupal ?
A module is software (code) that extends Drupal features and/or functionality. Drupal Supports – Core modules – 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 module – CustomModules” using PHP programming, and Drupal’s module API.
4. What modules do you always recommend and why?
Views – This module is essential in every website I build. It makes displaying lists of content very easy. If you want an image slideshow, a list of blog posts, a list of products, etc., views is the best place to start.
Panels – Panels gives you the ability to create custom pages easily. These custom pages can have multiple regions of content. For example, you may want to create a home page that has a Slideshow on the top, and a two column layout below.
Ctools – On its own, Ctools does not seem to do a lot. However, it is actually a very powerful framework if you begin developing your own modules. I have used Ctools in the past for developing multi-step forms, modal dialog boxes, and even multi-step forms inside of modal dialog boxes.
Token – Tokens are little snippets of text that can be used as replacement patterns. For example, if your website sends out emails and you want to add in the users name, or you want fill in a link path with a node id to provide a helpful link to content, tokens will save the day.
Pathauto – The Pathauto module is a necessity for any website that frequently adds new content. It is also especially important if you have a website that allows users to create content using content types. Pathauto simplifies creating clean and search engine friendly URLS for the various content you add to your site.
Webform – If you want to provide easy to fill out forms for the visitors of your site, the Webform module will help you out.
Rules – Drupal rules will allow you to set up condition actions.
Date – This is useful for allowing the easy selections of dates in content types (with a nice date popup). It also integrates nicely with the views module.
Libraries – Makes organizing your various libraries of functionality easy (see Jquery UI above for an example).
Google Analytics – I don’t build a Drupal website without adding Google Analytics. This module makes it very simple. What gets measured, gets improved after all.
5. What are hooks in Drupal ?
hooks are drupal api code which allows module 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 file name is thus foo.module) and “bar” is the name of the hook. Each hook has a defined set of parameters and call back functions to trigger functionality on specific event. For example if you use form with submit button, on submit event you can have specific functionality.
6. How does caching work in Drupal?
Drupal caching system allows customized settings to speed up website using different configuration with page caching, block caching and lifetime for cached pages.
If enables, page caching will only be used for anonymous users.
If you enable page caching, the entire HTML of each page will be stored in the database. This significantly reduces the amount of queries needed.
This automatically means that blocks will also get cached, disregarded their own cache settings.
If Varnish is configured, this will also enable varnish caching
The page cache max-age will be used (see below) for each page.
You can check the “X-Drupal-Cache” HTTP header to check if this cache is HIT.
If you enable block caching, without enabling page caching, the block cache settings will be used (for anonymous and authenticated).
The defaults for most blocks is “don’t cache” because that is the default for blocks who don’t have their cache settings specifically declared.
You can use block_cache_alter module to set this for each block.
When it’s block created by Views, you can set the cache settings for a block in Views.
Minimum cache lifetime:
This is the amount of time before the page cache is cleared.
Page caches are cleared on each cron run (system_cron).
Be warned: incorrect settings of your cron and this setting might kill your website performance. See also this issue.
Expiration of cached pages:
This only applies for external caching mechanisms, for example your browser cache or Varnish.
It sets the Cache-Control max-age value in the HTTP-HEADERS.
This setting only takes effect when page caching is turned on.
7. How database system of Drupal works ?
In Drupal, each type of information has its own database table. For instance, the basic information about the nodes of your site are stored in the Node table, Comments and Users also have their own database tables, and roles, permissions, and other settings are also stored in database tables.
8. What is Database abstraction layer in Drupal ?
Allow the use of different database servers using the same code base.
Drupal provides an abstraction layer with the ability to support multiple database servers easily. The intent of this layer is to preserve the syntax and power of SQL as much as possible, while letting Drupal control the pieces of queries that need to be written differently for different servers and provide basic security checks.
Most Drupal database queries are performed by a call to db_query() or db_query_range(). Module authors should also consider using pager_query() for queries that return results that need to be presented on multiple pages, and tablesort_sql() for generating appropriate queries for sortable tables.
9. How do you handle upgrades?
Steps to Upgrade drupal minor version.
backing up the site,
putting it into maintenance mode
downloading the new version of the module
testing the site
taking the site out of maintenance mode
Steps to Upgrade Drupal major version.
Backup your existing site and database.
Log in as user ID 1
Put your site in maintenance mode
Change all themes to Garland
Disable non-core modules
Remove default settings file
Remove all old core files and directories
Remove uninstalled modules
Download Drupal 7
Re-apply modifications to core files
Make your settings.php file writeable
Run the update script
Backup your database
Update contrib modules and themes
Check the Status Report
Make sure settings.php is secure
Check Drupal Core Modules
Remove your site from Maintenance Mode
10. How to debug code in Drupal?
Simple using print_r or var_export , you can debug code within Drupal.
$node = node_load(123);
Drupal devel module provides dsm and dpm functions to debug code within drupal.
$node = node_load(123);
drupal latest version provides debug inbuilt function to print errors, notices and warnings as well.This could be in the page or in the logs depending on how php is configured.
$node = node_load(123);
The full options for debug function are:
debug($data, $label, $print_r);
The $data is pretty self explanatory. It can be anything you could pass through print_r or var_export. The $label allows for a custom label to be added. This is ideal when you are sending the information to a log and you want a key to search the logs for. The 3rd argument is whether to use print_r or var_export. The default is var_export. If you are interested between the two I’d suggest reading the manual pages.