[support] Block visibility quandry
Richard Burford
rich at freestylesystems.co.uk
Thu May 29 10:59:31 UTC 2008
How about:
<?php
(arg(0) == 'user' && is_numeric(arg(1)) && is_null(arg(2))) ? return
TRUE : return FALSE;
?>
psynaptic
http://freestylesystems.co.uk
http://api.freestylesystems.co.uk
On 29 May 2008, at 11:46, Neil: esl-lounge.com wrote:
> 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/ ]--
> [ Drupal support list | http://lists.drupal.org/ ]
More information about the support
mailing list