6+
votes
894 views

For Drupal 7 :

drush vset maintenance_mode 1  // To take website into maintenance mode
drush vset maintenance_mode 0  // To take website into live mode

For Drupal 6 :

drush vset site_offline 1  // To take website into maintenance mode
drush vset site_offline 0  // To take website into live mode
11+
votes
897 views

In this example you can line up 3 divs in the same line

HTML :

<div class="main-class">
    <div class="sub-class">C1</div>
    <div class="sub-class">C2</div>
    <div class="sub-class">C3</div>
</div>

CSS:

.main-class
{
    display: table;
    width: 100%; /*Optional*/
    table-layout: fixed; /*Optional...
Read More
40+
votes
981 views

By using a div with style z-index:1; and position: absolute; you can overlay your div on any other div.

z-index determines the order in which divs 'stack'. A div with a higher z-index will appear in front of a div with a lower z-index. Note that this property only works with positioned elements.

50+
votes
869 views

To make a certain part clickable and then hide it when you click anywhere else, you need to check if your click place has certain class then show it otherwise hide it.
So we will check our click on whole document and then we will see if it has certain class attached to it or not. Like this :

(function ($) { 
// Check the click on whole DOM
$(document).on('click', function(e) {
       // Check if target has certain class
        if($(e.target).hasClass('...
Read More
28+
votes
1218 views

To resolve this error you must wrap your JavaScript inside function like this :

(function ($) { 
  // Your jQuery code.
  $('#something1').click(function () {
    $('#something2').slideToggle();
  });
  //Put your code between these comments.
})(jQuery);
48+
votes
1203 views

By default drupal date module stores all the values in the UTC format and to change it into the current local time format you can do something suggested in this post for the conversion :

http://techrappers.com/post/69/how-convert-utc-dates-local-time-php

The above post will give you exact local time after conversion which can be used in sql query for comparison.

28+
votes
1181 views

Get the value of UTC time and convert it into unix timestamp and then convert that timestamp to date will give you exact local date and time.

$time = strtotime($dateInUTC.' UTC');
$LocalDate = date("Y-m-d H:i:s", $time);
22+
votes
1843 views

Nice Menu module of drupal by default provide hover support of mouse. This tutorial will show you how to add an on-click event support for nice menus.
This post also solves the issue listed over here https://www.drupal.org/node/352711

1) Override the default superfish.js provided with the nice menus module. Nice menus superfish javascript provide the on-hover support but you have to override with the new superfish.js which provide...

Read More
15+
votes
1623 views

To display the row number generally we can use the views "Global: View result counter (ID)" field in the view but if your view is grouped by
any specific field then it will start displaying the wrong row number. It will show the on the basis of the latest uploaded content.
You can correct this by using PHP and its quite straight forward.
For this you have to create a template inside your theme/templates folders.

1) Name the template
Go to your view ->...

Read More
44+
votes
1138 views
// *convert array to object* 
// Array([id]=> 123 [username]=>techrappers)
$object = (object) $array_name;

//now it is converted to object and you can access it.
echo $object->username;