Search This Blog

Thursday, November 3, 2011

How to display a drupal block on a particular || specific page?

Well, I wont say this is the shortest solution, but I guess for non-programmer it just might be the simplest and yet effective solution.

It's been quite sometime that I've really coded and since the time I came across Drupal most of my time has been in learning the admin part and so haven't quite got the time to dive into Drupal development.

Anyway, I will try to explain you my trick using an analogy that I just encountered a short while ago. I was trying to configure the visibility of certain blocks related to the Organic Module. I wanted certain blocks to appear only on the Organic module and tried two solutions but they couldn't quite meet my need of the moment.

As we know in the Drupal's Page specific visibility settings we have three options, namely:

1. Show on every page except the listed pages.
2. Show on only the listed pages.
3. Show if the following PHP code returns TRUE (PHP-mode, experts only).


We are going to use the 2nd option for our solution.


Solutions #1: 

Here, selecting the "first option" I applied these settings below:

og [[refers to the main organic group page in your site ==> http://www.example.com/og ]]
og/*  [[in Drupal * is a wildcard entry, here it means, the main og page, and all the various og pages]]

The problem I encountered using this solution was that, since the group topics, are content-type, once i visited a certain group topi, the url would change to something like this ==> "www.example.com/node/12." Because of this using the solution ==> og/* was pointless.

Then again I tried this solution using a PHP snippet from this website ==> http://geshan.blogspot.com/2009/11/show-drupal-blocks-only-on-specific.html, I liked his solution but it quite didn't fulfill my requirement.

So eventually I came up with my own basic and simple solution. It's just tweaking the first solution. In the block configure page:

Select ==> "Show on only the listed pages."
and type this in the box below each statement in a new line:
og
og/*
node/12 

Note: You will have to find the node id. of your group content-type and replace 12 with it. To find the node-content type,simply edit that content-type and check the url.. there you should be able to view the node-number(id)

Converting 7zip (.7z), WinZip (.zip) files into Gzip (.gz) in Windows

This solutions especially helped me a lot for importing my "MySQL Dumps" from my local server to my remote server.

My problem & How this Solution Helped me:

My web-host seem to have restricted "importing .zip mysql dumps" to my server. And my Xampp which is an older version (XAMPP for Windows Version 1.7.1 !)  don't seem to work well with Gzip. The newer version of Xampp does work well but since right now I am obliged to use PHP 5.2.x I haven't upgraded.

So, blabbing apart, here's the solutions:

Use this small but very powerful called Win-Gz tool to compress / decompress any file(s) into .gz (GZip) format. You can also use ArcConvert to make compression from .7z into .gz ... .gz into .7z etc...

Here are the download links:

1. Win-GZ
2. ArcConvert

Hope this helps .... have fun!

Top Magento Hosting:

Top 5 Posts (Weekly)