[Radiant] conditional display of image
Mathieu Arnold
mat at mat.cc
Thu Oct 11 06:28:18 CDT 2007
Hi,
I'm attaching some images to some posts on my blog, and as I don't want to
have too big images on the home page and on the archive pages, I devised the
following code that I put on the first part of my page
<r:unless cond="!request.nil? && Regexp.new(tag.locals.page.slug) =~
request.env['REQUEST_URI']">
!{float:right}<r:attachment_url transform="120" id="10"/>(foo)!
</r:unless>
<r:if cond="!request.nil? && Regexp.new(tag.locals.page.slug) =~
request.env['REQUEST_URI']">
!{float:right}<r:attachment_url transform="200" id="10"/>(foo)!
</r:if>
(the 120 and 200 transforms resize to 120x120 and 200x200)
The strange thing, it that I don't always get a "request" object, and I'm
wondering if there could be a better way to do that, the main point being "is
the page being displayed is the page I belong too".
Regards,
--
Mathieu Arnold
More information about the Radiant
mailing list