[support] Block visibility quandry

Neil: esl-lounge.com neil at esl-lounge.com
Thu May 29 10:46:40 UTC 2008


I am almost there. Right now I have:

<?php
if(arg(0)==user && ctype_digit(arg(1)) && arg(2)!=edit) { 
return TRUE; 
} else { 
return FALSE; 
}
?>

which prevents the block from showing on user/2/edit, etc. Is there a way I can check for the existence of arg(2) and not show the block if it exists? That would eliminate user/2/edit, user/2/track, user/2/contact and some other possibilities. I could manually alter my current code to block out contact/track but I'd prefer a kill-all solution.

thanks

Neil
  ----- Original Message ----- 
  From: Shai Gluskin 
  To: support at drupal.org 
  Sent: Wednesday, May 28, 2008 1:32 PM
  Subject: Re: [support] Block visibility quandry


  Hi Neil,

  I don't know if the UI for the block module settings will allow regular expressions. I doubt it, but give it a try and report back.

  However, what will surely work is putting in your own php. Have you noticed that radio for adding PHP to return "TRUE" to make block visible? That's your answer.

  Here's a code snippet that should get you started:
  http://drupal.org/node/64135#page-visibility

  Here is one that is a little more sophisticated which was designed for the Google Analytics module... when to include the tracking code on a page -- totally analogous to block visibility:
  http://drupal.org/node/261997

  Good luck. And please add your snippet to the handbook page.

  Shai


  On Wed, May 28, 2008 at 5:57 AM, Neil: esl-lounge.com <neil at esl-lounge.com> wrote:

    I have a block which I show on a user's main page, user/1, user/2, etc.

    I have set block visibility to "only show on pages" with user/* entered below.

    Unfortunately, it's also showing on user/register, user/password.

    I don't suppose I can use regular expressions to make the wildcard ONLY numeric, can I? How would I get the block to show on user/7 but not user/register?

    Thanks

    Neil

    --
    [ Drupal support list | http://lists.drupal.org/ ]





------------------------------------------------------------------------------


  -- 
  [ Drupal support list | http://lists.drupal.org/ ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20080529/56df74f9/attachment-0001.htm 


More information about the support mailing list