2

How do I show a <div> inside page.tpl.php, on every page except for URLs that start with "audio/track"?

1

If the page is not a node (is a landing page, view, panel etc) you can use the function arg

if(arg(0) != "audio" && arg(1) != "track") {
  print "<div></div>";
} 

Or if is a node you can make the conditional using a taxonomy or using the node type.

if(arg(0) == "node" && is_numeric(arg(1)) && $node->type != "your-node-type" ){
  print "<div></div>";
}  
0

In the configuration or your block you've a "Page specific visibility settings". Choose the "Show on every page except the listed pages." option and in the textarea below add your url.

In your case it will be something like that /*/audio/track

In the code, you can directly use the function drupal_match_path, you get the current path with request_uri function and in the patterns you add the example given above.

  • Sorry but i kinda said, The <DIV>content</DIV> not the drupal block. – Alexander Kim Nov 1 '11 at 6:40
  • I edited my answer to fit your request. – yvan Nov 1 '11 at 7:06

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.