Hi,

I've found a workaround in the blog layouts which come with radiant:

<r:if_url matches="^/articles/\d{4}/\d{2}/\d{2}/.+"><r:unless_url matches="-archives/$">
<!-- do your article stuff here -->
</r:unless_url></r:if_url>

These checks together match single articles only. But I really would prefer the check of r:if_url against the request path and not against the page.url attribute.

Best Regards
Horst

Am 26.09.2010 20:40, schrieb Horst Rischbode:
 Hi Jim,

I use this construction within my layout to check, if I am on an article page or some kind of index pages. Some things only should be shown on single article pages (rating, next/previous page,....). This is the way, which is given by the blog_tags extension.

Is there any other way, to check, if I am on a single article page?

Thanks for any advice!

Horst

Am 26.09.2010 19:15, schrieb Jim Gay:
On Tue, Sep 21, 2010 at 4:50 PM, Horst Rischbode<ho...@horibo.de> wrote:
  Hi,

this is really strange. In my pages, I have the following code:

<r:if_url matches="^/articles/\d{4}/\d{2}/\d{2}/.+">
    # do something brilliant
</r:if_url>

This regexpr matches to:
/articles/2010/08/
/articles/2010/08/07/xyz

All tests with several online regexpr matchers match the second url only,
which I would expect for my code, too.

I'm on Windows with MySQL and Ruby 1.8.6 with Radiant 0.9.1 installed.

Any idea, what's going wrong?

Horst

Here's the problem with if_url: it uses this to check the url

  unless tag.locals.page.url.match(regexp).nil?

Notice that it's checking the page.url and not the request path. That
should probably be changed (and well-tested patches are always
welcome).

So it's not checking the actual request, it's checking the current
page's url attribute. I'm just quickly looking at this but I would
think it wouldn't match either of those paths.

What are you trying to achieve? And are you using the
ArchiveMonthIndexPage type for a separate page or just checking the
url on individual articles?





Reply via email to