What is Drupal
Drupal (pronounced Dru-Pull) is an open source content management system offering a toolset that rivals those of most commercial alternatives. With integrated social media and e-commerce functionality, it provides unique value as part of your social media strategy.
What Does Drupal Do?
Drupal is the choice for many great web sites because it does a lot of different things very well, and allows different kinds of information to interact effectively through its flexible, open architecture. Compared with commercial or custom solutions, Drupal’s feature set is far more economic and practical for most organizations.
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.
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.
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.
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.
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
- uncompressing it
- running update.php
- 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
- Run the update script
- Backup your database
- Upgrade fields
- 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
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.
What does Views do and how do you use it?
Views is a practical necessity for sites built on Drupal 6, and it’s imperative that your developer understands how to take advantage of it. Earl Miles has written a great summary on the Views project page.
- What’s an example of a project where you needed to use Views?
Explain Region, Block, Menu in drupal .
Pages on your Drupal site are laid out in regions, which can include the header, footer, sidebars, and main content section; your theme may define additional regions. Blocks are discrete chunks of information that are displayed in the regions of your site’s pages. Blocks can take the form of menus (which are concerned with site navigation), the output from modules (e.g., hot forum topics), or dynamic and static chunks of information that you’ve created yourself (e.g., a list of upcoming events).
There are three standard menus in Drupal: Primary Links, Secondary …
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).