Drupal-Image Gallery

  • Inoder to create an image gallery in drupal we have to first download two  modules  Images  and  Thick Box.
  • Then goto sites /all/create a folder there called “module” and copy the downloaded modules inside the folder.
  • Goto administer ->module->image and enable every check boxes
  • Also enable thickbox option and save the configuration

Continue reading

Drupal block with dynamic content

Step1: Login as admin and select Administer->Blocks and click on the “add block page” link on the top.
Step2: Enter description and title in the Block description, Block title textboxes.
Step3: In the Block body textarea, enter following text: “

” and input format should be full html.
Step4: Move your block to left, right or footer region and click on save blocks button.
Step5: Goto your sites/all/modules/your_module folder. Open any .js file which is included in your .module file or you have to create a new .js file and include it in your .module file (use drupal_add_js()).
Step6: Add following lines in it:
Step7: Include jQuery.js file in your .module file or you have to convert the code to Javascript:

$(document).ready(function(){
	block_animation();
}
function block_animation(){
	var jsArray = Array();
	jsArray[0] = "Your Dynamic Content1";
	jsArray[1] = "Your Dynamic Content2";
	jsArray[2] = "Your Dynamic Content3";
	jsArray[3] = "Your Dynamic Content4";
	jsArray[4] = "Your Dynamic Content5";
	// the following code will generate a number from 0 to 4
	var sel_index = Math.floor(Math.random()*5);
	$("#dynamic_block").html(jsArray[sel_index]);
	setTimeout("block_animation()", 2000);
}

Drupal Installation

Simple install of Drupal on XAMPP
Drupal 6.x

1. Download the latest compatible copy of XAMPP and install it on your C:\ (or main) drive. It worked better locating it at C:\ directly and not in Program Files.
2. Open the c:\xampp\htdocs folder and create a subfolder. For this example, we’ll call it “drupal” (C:\xampp\htdocs\drupal).
Download the latest copy of Drupal, and extract it into this folder.
Continue reading

How to change drupal site offline mode to online

Once you changed your site mode from online to offline via admin->Site Maintenance,  you will not get a login page to login as admin and change the mode from offline  to online. So you have to browse like following:

http://www.yourwebsite.com?q=user/login,

Then login as admin and click on “Site Maintenance” menu and change site mode to online.

Drupal-site map

SiteMap module provides a site map that gives visitors an overview of
your site. It can also display the RSS feeds for all blogs and
terms. Drupal generates the RSS feeds automatically but few seems
to be aware that they exist.
The site map can display the following items:
  • A message to be displayed above the site map
  • The front page.
  • The latest blogs.
  • Any books that optionally will be displayed fully expanded.
  • Any menus that will be displayed fully expanded.
  • Display comment RSS links if the Comment RSS module is installed.
  • A syndication block, the “more” link goes to the site map.

Continue reading

Inserting Page Break in Drupal Printer-Friendly Version

Open  sites/all/modules/print/print.css and add following lines in it:

@media screen {
.page-break    { height:5px;  border-top:1px dotted #cccccc;  }
}
@media print {
.page-break { height:0; page-break-before:always; margin:0; border-top:none; }
}

after that,  put the following code in your Drupal’s page, wherever you need page break :

<div class=”page-break”></div>

Test it and enjoy!

Drupal Site Migration

Migrating Drupal from one folder (or one server) to another is not always as simple as just copying the files and database. All the file paths, configuration data, content, menus & structure are stored in the Drupal database. Hence, just a blind copy will break the new Drupal system.

Steps to migrate your drupal installation from on folder to another (or one server to another)

  1. Copy all the files from the current destination to the new destination
  2. Make the database changes in sites/default/settings.php
  3. Browse the new destination and complete the new Drupal installation steps
  4. Login into the Admin area and ensure that the same modules are enabled in both the installations.
  5. Install the ‘Back and Migrate‘ module in the current Drupal installation
  6. Take a backup of the current system and download it. It will be a .mysql file
  7. Install the same ‘Backup and Migrate‘ module in the new Drupal site
  8. Upload the downloaded backup file to the sites/default/files/backup_migrate/manual folder in the destination Drupal site.
  9. Login into the Admin area in the new Drupal and browse
    http://[my-new-drupal-url]/admin/content/backup_migrate/destination/list/files/manual
  10. Here you will see the list of backup files to choose from. Click the ‘Restore‘ link next to the backup file that you just uploaded.

Thats it! Now all your menus, content etc should be imported correctly.

NOTE: Restoring will delete some or all of your data and cannot be undone. Always test your backups on a non-production server!