Archive for the ‘Drupal’ Category

Drupal Custom Breadcrumb visibility PHP code

I needed to show a custom breadcrumb on specific pages by URL.

The nodes in question were of “page” content type.

The URLs of these nodes were like:
/green/page3 and so on.

I only wanted the custom breadcrumb to show up on:
and not on /green

I created a breadcrumb with title “Green” and path “green” and used this PHP code for visibility:

$p= explode('/', $_REQUEST['q']);
return ($p[0] == 'green' && $node->nid != 79);

where 79 is the Node ID of the /green page.

I was able to get the desired result!

Note to self: print_r statements are your friend

Debugging a Drupal theme this early morning and remembered that using a print_r statement can provide all of the variables in a debug format for you.

print_r(explode('/', $alias));

I'm currently available
for Lotus Notes / Domino consulting engagements.


Connect with me: