Responsive Design in drupal


Responsive design provides a way for your site's content to be viewed in an optimal way independent of screen size. It subscribes to the "one web" idea where you only build one site for all channels, instead of a dedicated mobile version.
Responsive design is a good solution for many web site owners and builders, and while it won't suit every use case it's certainly a compelling and popular concept.
Responsive design uses a blend of fluid layouts, CSS3 media queries and flexible images that when combined allow your site to adapt to the device it's being viewed on.
Your standard desktop site might be three columns, but in your average smartphone you might want to display only one column - this is entirely doable using responsive design - it's a way of re-flowing the content and layout to suit the width of the device.
You can read more about responsive design here:http://www.alistapart.com/articles/responsive-web-design/
Drupal themes that support responsive design out of the box include:Zen 7.x-5.x
Adaptivetheme
Omega

Important Drupal Drush Command


Some Important Drupal Drush Command:

When available, there is a shorter version of the same command in parentheses.

  • cache clear (cc) Clear all caches.
  • cron Run all cron hooks.
  • disable (dis) Disable one or more modules.
  • download (dl) Download core Drupal and projects like CCK, Zen, etc.
  • enable (en) Enable one or more modules.
  • eval Evaluate arbitrary php code after bootstrapping Drupal.
  • help Print this help message. Use --filter to limit command list to one command file (e.g. --filter=pm)
  • info Release information for a project
  • installcore (ic) Install Drupal core via the specified install profile. Note that updating core with
  • Drush is not yet available. See http://drupal.org/node/434944.
  • refresh (rf) Refresh update status information
  • script Runs the given php script(s) after a full Drupal bootstrap. NOTE: you can't supply absolute paths
  • to the script e.g. ~/Desktop/script.php won't work Desktop/script.php will
  • sql cli (sqlc) Open a SQL command-line interface using Drupal’s credentials.
  • sql conf Print database connection details.
  • sql connect A string for connecting to the DB.
  • sql dump Exports the Drupal DB as SQL using mysqldump.
  • sql load Copy source database to target database.
  • sql query (sqlq) Execute a query against the site database.
  • status (st) Provides a birds-eye view of the current Drupal installation, if any.
  • statusmodules (sm) Show module enabled/disabled status
  • sync Rsync the Drupal tree to/from another server using ssh.
  • test clean Delete leftover tables and files from prior test runs.
  • test mail Run all tests and mail the results to your team.uninstall Uninstall one or more modules.
  • update (up) Update your project code and apply any database updates required (update.php)
  • updatecode (upc) Update your project code. Moves existing project files to the backup directory
  • specified in the config.
  • updatedb (updb) Execute the update.php process from the command line.
  • variable delete (vdel) Delete a variable.
  • variable get (vget) Get a list of some or all site variables and values.
  • variable set (vset) Set a variable.
  • watchdog delete (wd) Delete all messages or only those of a specified type.
  • watchdog show (ws) Shows recent watchdog log messages. Optionally filter for a specific type.

Debugging Drupal using devel module

In addition to the core module, the Devel package contains some other useful modules:
  • Devel generate: Generates dummy users, nodes, and taxonomy terms.
  • Theme developer: Displays theme API information for theme developers. (Note that this module doesn’t work if Drupal for Firebug is enabled.)
These modules are not covered in this guide. See the Drupal handbook for more information. Installation
  • Download and install the latest version of the Devel module from Drupal.org.
  • Go to Administer → Build → Modules and enable the Devel module.

dpm()

Prints a variable to the ‘message’ area of the page using drupal_set_message(). You can use this function to keep track of one or more variables when you’re working on the code running your site. Because the Devel module now comes with Krumo, the output is compact and unobtrusive.
dpm($input, $name = NULL)
If, for some reason, you are not using Krumo, you can use the $name parameter to distinguish between different calls to dpm().

dvm()

Uses var_dump() to print a variable to the ‘message’ area of the page using drupal_set_message(). The output of this function is harder to read than the Krumo-based output of dpmt(), but it can be useful if you need to copy and paste it to another application.
dvm($input, $name = NULL)
If, for some reason, you are not using Krumo, you can use the $name parameter to distinguish between different calls to dvm().

dpr()

Pretty-prints a variable to the browser (without using krumo). The output is displayed in the page header, making this a good choice if your theme doesn’t print the $messages variable.
dpr($input, $return = FALSE, $name = NULL)
Set the second parameter to TRUE if you want to return a string instead of printing it.
You can use the $name parameter to distinguish between different calls to dpr().

dvr()

Uses var_dump() to pretty-print a variable to the browser (without using krumo). The output is displayed in the page header, making this a good choice if your theme doesn’t print the $messages variable.
dvr($input, $return = FALSE, $name = NULL)
Set the second parameter to TRUE if you want to return a string instead of printing it.
You can use the $name parameter to distinguish between different calls to dvr().

kpr()

Pretty-prints a variable to the browser using krumo. The output is displayed in the page header, making this a good choice if your theme doesn’t print the $messages variable. Since it uses Krumo, it has the added advantage that the output is very compact and unobtrusive.
kpr($input, $return = FALSE, $name = NULL)
Set the second parameter to TRUE if you want to return a string instead of printing it.

dargs()

Prints the arguments passed into the current function. In this case, the arguments are ‘foo’, and ‘42’. You can use this function if you’re not completely sure of the arguments received by a specific Drupal hook or function in the code you’re working on.
dargs()

dd()

Logs any variable to a file named “drupal_debug.txt” in the site’s temp directory. All output from this function is appended to the log file, making it easy to see how the contents of a variable change as you modify your code.
If you’re using Mac OS X you can use the Logging Console to monitor the contents of the log file.
If you’re using a flavor of Linux you can use the command “tail -f drupal_debug.txt” to watch the data being logged to the file.
dd($data, $label = NULL)

ddebug_backtrace()

Prints the function call stack.
ddebug_backtrace()

db_queryd()

This function is the debugging version of db_query(), which prints the query and any error messages to the browser. This function is useful if you want to monitor a few database queries but don’t need Devel module’s list of all database queries used to build the current page.
db_queryd($query, $args = array())

Enabling Clean URLs in Drupal 7

In Drupal 7, the installer tests for compatibility with Clean URLs as a part of the installation process. If the environment is tested as compatible with Clean URLs, it will be enabled as part of the installation process and no further action is required to enable Clean URLs.
If you need to enable Clean URLs post installation, Drupal will run the clean URL test automatically when you navigate to the Clean URLs configuration page (Administer > Configuration > Search and metadata), show the results, and allow you to save configuration.
You can enable or disable it at a later time by following these steps:
  1. Navigate to the Clean URLs configuration page (Administer > Configuration > Search and metadata)
  2. Wait for the automated Clean URLs test to run.
  3. Check or uncheck the Enable clean URLs checkbox
  4. Click "Save configuration"
Even if Clean URLs are successfully enabled at install-time, if you have a dedicated server you may still want to follow the steps (below) to enable the more efficient httpd.conf rewrite method for clean URLs. If you choose to do that, you might want to turn off Clean URLs while you are working on the server
Note: 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.

How to Override a Drupal Views SQL Query


The queries that it builds are most often very elegant, but there are certain cases where you need to use a query that is just a bit too complicated for the Views query generator to build on its own. I ran into this recently where I could not accomplish my task without a join to a sub-query.

If you find this to be the case, you can utilize the views_pre_execute hook to override the query being supplied by Views.

function hook_views_pre_execute(&$view) 
{
  if($view->name == 'your_views_name') 
  {
    $view->build_info['query'] = "SELECT * FROM node";
  }
}


Once you have implemented this in your custom module, if you edit the view on your site, any changes you make that would normally change the query (sort criteria, filters etc.) will have no affect. However, you can utilize the options in 'Basic Settings', 'Page Settings' to edit the properties of how/where the view is going to display. When you use the 'Preview' button to test your view with various displays, your custom SQL query will be displayed so you can verify that it is being used.

You could just create a custom module with custom sql in lieu of using a view. However, if you have already built a view and styled your page/block based on the views generated elements you might not be looking forward to this. In this case you could use the above technique to override the query without disrupting the rest of the work you have done relying on the view.

What is Drupal?

Drupal is used to build web sites. It’s a highly modular, open source web content management
framework with an emphasis on collaboration. It is extensible, standards-compliant, and strives for
clean code and a small footprint. Drupal ships with basic core functionality, and additional functionality is gained by enabling built-in or third-party modules. Drupal is designed to be customized, but customization is done by overriding the core or by adding modules, not by modifying the code in the core. Drupal’s design also successfully separates content management from content presentation.

Drupal can be used to build an Internet portal; a personal, departmental, or corporate web site; an
e-commerce site; a resource directory; an online newspaper; a social networking site; an image gallery; an intranet; and virtually any other type of web site that you can imagine creating.

A dedicated security team strives to keep Drupal secure by responding to threats and issuing
security updates. A nonprofit organization called the Drupal Association supports Drupal by improving the drupal.org web site infrastructure and organizing Drupal conferences and events. And a thriving online community of users, site administrators, designers, and web developers works hard to continually improve the software; see http://drupal.org and http://groups.drupal.org.

Drupal is a free software package that allows you to easily organize, manage and publish your content, with an endless variety of customization.

Drupal is Open Source : Drupal is open source software maintained and developed by a community of 630,000+ users and developers. It's distributed under the terms of the GNU General Public License (or "GPL"), which means anyone is free to download it and share it with others. This open development model means that people are constantly working to make sure Drupal is a cutting-edge platform that supports the latest technologies that the Web has to offer. The Drupal project's principles encourage modularity, standards, collaboration, ease-of-use, and more.

ShareThis