In Drupal, can you control block display according to e.g. number of URL parts?

Posted by james6848 on Stack Overflow See other posts from Stack Overflow or by james6848
Published on 2010-03-15T15:28:32Z Indexed on 2010/03/15 15:29 UTC
Read the original article Hit count: 146

Filed under:
|

I'm having a little trouble controlling page-specific block display in Drupal...

My URL's will be of this typical structure:

http://www.mysite.co.uk/section-name/sub-page/sub-sub-page

The 'section-name' will effectively be fixed, but there will be many sub-pages (far too many to explicitly reference).

I need to somehow control block display as follows:

One block will show on all pages where URL contains 'section-name/sub-page' but not on pages 'section-name/sub-page/sub-sub-page'

Conversely, another block will show on all pages where URL contains 'section-name/sub-page/sub-sub-page' but not on pages 'section-name/sub-page'

My only idea is to do a bit of PHP that looks for the string 'section-name' and then also counts URL parts (or even the number of slashes). Not sure how to implement that though :)

Your help would be appreciated!

© Stack Overflow or respective owner

Related posts about drupal

Related posts about php