0

In a block configuration, I would like to show the block on /programs/* but not on programs/* /*

I have seen a number of questions similar to mine. Block display using wildcard, non-greedy for example.

The recommendation from the above link to use drupal_match_path() makes the most sense to me. I have implemented the following,

    <?php
if (drupal_match_path(current_path(), "programs/*") && !arg(2)) {
  return TRUE;
}
?>

expecting the block to appear on /projects/name but not on /projects/name/grandchild-node. The block doesn't appear anywhere. Just to test the system, I tried this:

    <?php
if (drupal_match_path(current_path(), "programs/*") {
  return TRUE;
}
?>

and still the block doesn't show. I'm certain that I'm doing something wrong that is very basic. Any ideas?

0

Hmm. Are you sure current_path() is returning the alias? cause I don't think match_path takes that in to consideration at all.

$path = current_path(); $path_alias = drupal_lookup_path('alias',$path);

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.