block_help() still talks about:

Only the show block on node pages: ^/node\.php
Only show the block on the user page: ^/module\.php\?mod=user
Show the block in main and blog pages: ^/(index\.php|module\.php\?mod=blog)

this is incorrect, since we now (RC) have not got module.php and node.php. Also the name=value pairs are now different, due to clean urls.

I cannot find the way it needs to be updated though. For i cannot get my path regular expression working.
This is either my ignorance with regexps or its a bug. I fear the latter.

Ber

Comments

killes@www.drop.org’s picture

Title: minor 'bug' in block help » Re: [drupal-devel] task #1855 : minor 'bug' in block help

On 5 Jun 2003, bkessels@www.mediarevolution.org wrote:

> my path regular expression working.
> This is either my ignorance with regexps or its a bug. I fear the
> latter.

I think this part of line 196 in theme.inc

preg_match('/'. str_replace('/', '\/', $block->path) .'/', request_uri()))) {

should be changed to

preg_match('/'. str_replace('/', '\/', $block->path) , request_uri()))) {

To match for pages on the main page you'd need to det the regexp to
^$
for matches on blogs to
^blog
etc.

Can you confirm this?

Cheers,
Gerhard

killes@www.drop.org’s picture

Title: Re: [drupal-devel] task #1855 : minor 'bug' in block help » Re: task #1855 : Re: [drupal-devel] task #1855 : minor 'bug' in block help

On 5 Jun 2003, bkessels@www.mediarevolution.org wrote:

> should be changed to
>
> preg_match('/'. str_replace('/', '\/', $block->path) , request_uri())))
> {

preg_match(str_replace('/', '\/', $block->path) , request_uri()))){

Would be better, me thinks.

> To match for pages on the main page you'd need to det the regexp to
> ^$

^(/|index\.php)$

> for matches on blogs to ^blog

^/blog

Cheers,
Gerhard

ax’s picture


> preg_match(str_replace('/', '\/', $block->path) , request_uri()))
> Would be better, me thinks.

this wouldn't work because str_replace('/', '\/', $block->path) is missing the pregexp delimiters ('/') [1] at start and end. you don't want to include these in every path expression.

or would you? if would be less convenient - on the other hand, you had more power in your expressions. you could use Pattern Modifiers [2], and you could use pattern delimiters other than the default '/' (well - we escape '/'s in the pattern, so this wouldn't be necessary). and: you had /real/ control over your expression. currently, how do you know that you don't need to escape '/'s?

thoughts?

oh, and regarding your regexps not working: you don't happen to have installed your drupal in an url subdir (http://yoursite.com/drupal)? because then you had to include this subdir in your regexp. the regexp is matched against request_uri(), and this is always the path from your www root url (everything after http://yoursite.com), including the first '/'.

[1] http://www.php.net/manual/en/ref.pcre.php
[2] http://www.php.net/manual/en/pcre.pattern.modifiers.php

killes@www.drop.org’s picture

Title: Re: task #1855 : Re: [drupal-devel] task #1855 : minor 'bug' in block help » minor 'bug' in block help

On 5 Jun 2003, ax wrote:

> > preg_match(str_replace('/', '\/', $block->path) , request_uri()))
> > Would be better, me thinks.
>
>
> this wouldn't work because str_replace('/', '\/', $block->path) is
> missing the pregexp delimiters ('/') [1] at start and end. you don't
> want to include these in every path expression.
>
> or would you?

Yes.

> if would be less convenient

How many paths are you goint to set per site?

[...]

> oh, and regarding your regexps not working: you don't happen to have
> installed your drupal in an url subdir (http://yoursite.com/drupal)?
> because then you had to include this subdir in your regexp. the regexp
> is matched against request_uri(), and this is always the path from your
> www root url (everything after http://yoursite.com), including the
> first '/'.

Maybe we should strip the subdir part from request_uri before comparing.
You could then set up your site in a subdir and simply move it if you go
life.

Cheers,
Gerhard

bkessels’s picture

Title: minor 'bug' in block help » Re: [drupal-devel] task #1855 : minor 'bug' in block help

>To match for pages on the main page you'd need to det the regexp to
>^$
>for matches on blogs to
>^blog
>etc.
>
>Can you confirm this?

I think this question was pointed at me.
However, if i try these, i do not see anything. But i have to admit that i do not use clean urls. Just ?q=blog points to my blog.

i tried
^\?q=blog
^/\?q=blog

but they both do not work. So even if it is a bug, the help needs some updating. I'd like to do it, but lack knoledge on regexpressions. (i can use them a little, so i'm not a complete fool :)

Ber

al’s picture

Title: Re: [drupal-devel] task #1855 : minor 'bug' in block help » minor 'bug' in block help
killes@www.drop.org’s picture

Assigned: Unassigned » killes@www.drop.org

This got fixed.

Anonymous’s picture