Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » How-To

How to Show Block in PHP-Mode on Your Drupal-Based Site

Submitted by on December 26, 2009 – 10:03 amNo Comment

This article is for experienced developers who are close with PHP. It would tell you a little trick of how one can show his block if PHP code returns TRUE. Let’s begin!

So, first navigate to the Blocks area. Please select Administer > Site building > Blocks from admin navigation menu:

clip_image001

Then select the block you wish to deal with. Let’s work with, for example, standard User login block. In the list of blocks, set region (place the block will be allocated in) from the appropriate drop-down list within the Region column:

clip_image003

Then click configure link. You will be immediately navigated to the ‘User login’ block details. Set the required parameters if necessary and scroll the page down until Page specific visibility settings:

clip_image005

Within this area, click Show if the following PHP code returns TRUE (PHP-mode, experts only) radio button and place the code into the Pages text area. The code may be:

<?php if($a == $b) return true; ?>

In this case, the block will be shown once $a == $b.

Please be sure that the code is between <?php ?>. Also note that executing incorrect PHP-code can break your Drupal site.

We’re almost there! Click Save block to save your changes.

Done!

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.