Tuesday, March 10, 2009

Restricting Block visibilty to particular taxonamy tagged pages

Hi,here i am going to show how to create a block visible to only those pages that are tagged with same taxonamy terms.As you know drupal is very powerful a little understanding on drupal can make you to do dynamic stuffs in your websites that usually take hours of coding in normal web development enviornment.

Step 1
Go to block page

Step 2
Select the block that you need to change the visibility

Step 3
Select show block on specific pages

Step 4
Choose PHP code

Step 5
Type the following codes in PHP tag

if(arg(0)=='node' && is-numeric (arg(1)))
{
$nid=arg(1);
$node=node_load ($nid);

foreach($node->taxonomy as $term)
{
if($term->name=='video')
{
return TRUE;
}
}
}
return FALSE;



In this case video is my term .Change the video with the appropriate term name from your taxonomy.

Create a Custom Block Area

Hi,here i am going to describe how can we create a custom block area in drupal. As you know most of the templates are comming with header,content,right,left and footer region.We are going to enhance the drupal flexibility with adding more regions so you can add separate CSS for each regions and make your website more flexible.

Step 1
Go to Your theme ".info" file.(You can see this in your theme folder)

Step 2
You will be able to see the existing region over there.
Add -> regions[regionname] = region label
Here regionname is the drupal redable region name and region label is the name of the label you can see in block area.

Step 3
Go to page.tpl and add a 'div' where you want to display the region and print the region name.

Add a div and use php print statement eg:print menuregion

Note: no semicollum after print statement

Step 4
The contents of .info file is cached in database . So you need to clear the database cache inorder to see the changes you made.To clear databse cache
Administer > Site Configuration > Perfomance
Click on empty Cache

or you can achive this by going to database using phpmyadmin and empty the cache tables.
Visit the block page inorder to see the block region you have added.

Good Luck


Monday, February 23, 2009

Integrating Gallery 2 (Latest)

This summary is not available. Please click here to view the post.

Struggling Days Over

I was pretty busy with my projects in last few months , so i was unable to do any blogging. So here i started it again all over. Now i am prettry much sure abot my girlfiend(Drupal) she can do what ever i want  . But most of the cases it took a few days of customization.

Tuesday, September 30, 2008

Gallery 2 Theme : Change the look and feel

Need to change the look and feel of gallery 2 theme:


Here i am changing flotrix theme . Usually gallery have a navigation on top and below. I am removing it and i am aligning it on below.

1) Go to gallery2\themes\floatrix\templates
(take a back up of templates folder )

2) To change the look and feel u need to change 2 files album.tpl and photo.tpl search for block type="core.ItemInfo" there u can disable or enable album properties.

3) Look for gbBlock gbNavigator there u can align your user links

3)theme.navigator u will be able to align paging options


Gallery 2 Integration with Drupal


After a long struglling of 3 days , i finished gallery 2 integration with drupal.

Here is the details

Software used :
DRUPAL 6.4 ,GALLERY 6.x-1.x-dev(DRUPAL MODULE), GALLERY gallery-2.3-rc-1

STEPS TO FOLLOW :

Create a folder gallery2 inside drupal.
Install your Gallery 2 inside that folder.
Access the gallery using url eg: www.xxx.com/gallery2 and install it make sure you enabled url rewrite plugin.
Copy the galery module of drupal inside sites/all/modules and enable it.
Access the gallery setings inside the drupal navigation menu.
Use the manual configuration and set as follows:

Gallery2 URL or URI: /gallery2/
Gallery2 filesystem path: ./gallery2/
Embed URI: /index.php?q=gallery
Gallery base: gallery

Finish it and access URL Rewrite Administration ,you can access it by clicking on gallery on drupal navigation > site admin > Url rewrite

inside setup you can see Embedded Setup .it will show below the Allow empty referer? . You must access the side admin of gallery from drupal to see the embeded setup.

Absolute path to the folder of your embedded .htaccess: /var/www/drupal
Please enter the Url to your environment. E.g. http://www.mySite.com/myNiceCMS/ : /(a slash usually refer to drupal directory).

Make sure the htaccess file (inside drupal folder have a write permission you can set it to 666 or 777).