Forum: Radiant CMS url parameters

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
75f2022f13e4e677d080a2009c8a6dfb?d=identicon&s=25 Francesco Lunelli (Guest)
on 2007-05-13 23:29
(Received via mailing list)
s it possible to capture query parameters and use them inside tags?
For example if I have a URL like this can I caputre the lang parameter and
pass it to some tags?
Having a page made with to parts "it" and "eng" I could decide wiche
part show in a way like this:
<r:content part="LANG" /> where lang is the url parameter captured.
But this could be useful in many other situations I think.
Thanks to everybody
Francesco Lunelli
8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (Guest)
on 2007-05-13 23:37
(Received via mailing list)

Yes, if the page is uncached.  Another option would be to use the
language_redirect idea where you have multiple sub-sites for each
language, but I know that's not ideal in terms of reuse.  Anyway,
inside a tag definition, you should have access to the request and
response variables.  There are discussions about this previously on
the mailing list, just do a search at

653df32382f1dd1fc89754c4582858ae?d=identicon&s=25 Daniel Sheppard (Guest)
on 2007-05-14 03:21
(Received via mailing list)
> Francesco Lunelli
If you're willing to get down and dirty and write and extension, I've
had some thoughts on how to implement a better langauge
extension - the different trees provided by the language redirection
extension don't strike me as particularily friendly to keep up
to date, and your suggestion is pretty close to what I've got in my

Basically, there would be a parent 'language selector' page, all
children below that point can have differently languaged parts.

When the parent page's find_by_url method is called, it sets
LanguagePage.language = 'en' (not 100% sure on the best mechanism, but
that'll do off the top of my head)

When children are asked for a page part, say 'body', they would first
look for 'body_en' and only revert to 'body' if that does not

So you'd have a single tree of pages, but they would be served through
different urls:


I've got no real use for international stuff in the forseeable future as
I run a local site for local people, so I don't think I can
be bothered actually writing the code to do this, but I've got it all
pretty much in my head if anybody wants some further detail to
pursue it themselves or some monetary motivation for me to write it.

75f2022f13e4e677d080a2009c8a6dfb?d=identicon&s=25 Francesco Lunelli (Guest)
on 2007-05-15 10:43
(Received via mailing list)
Thanks for the answers.
The possibility of capturing query parameters is not limited to
addressing different part of pages, but it could be useful in many ways,
I hope this possibility will be included in standard radiant
In this case I used it to include static html pages into radiant
generated pages.
I have a customer that decided one of his emplyee MUST do some pages
using an editor like nvu. (Learning to use radiant cms is too difficult
for her)
But the rest of the site is generated from radiant, menu and pages etc.
For the moment the tag is customised to my needs, but I think it could
be easily modified to any needs.
First of all I modified the site_controller.rb according to this post

Then I created a custom tag

  require 'net/http'
  require 'uri'

  tag 'inner_site' do |tag|

# site is the url of the site I want to include risposta is the html
page I will get back

    site = tag.attr['site']

# this is the radiant pag with "inner_site" tag for example
# the page "including" shoud be simply <r:inner_site
site="" />


# this caputures the query string parameter (it should be made better
capturing all parameters in a hash with name and value, bu for the
moment it woks) The var @pagina contains the stati html page I want to
include. i.e /html/iniziative.html do | param |
      @pagina = param[1].to_s.dup
    if site
      url = URI.parse(site)
      res = Net::HTTP.start(, url.port) {|http|
        @pagina ? http.get(@pagina) : http.get("/html/iniziative.html")
# here I replace every internal link with a link to the radiant page
adding in the url the query string for the new page
#external links (those starting with http://) are leaved unchanged
# this part need a lot of work to be useful in every situation (pages
made with mac osx have different new line charachter, there should be a
better way to control if the link is internal or external) but form my
needs work enought.
# images and css paths are unchanged, so you will not see images and css
      res.body.each_line {|line|
        risposta+=  line=~/http/ ? line :

now you can use this form to include radiant site in your page

Francesco Lunelli
Ymir s.r.l.
Viale Verona 190/11
38100 Trento
6fba23932472b6763041f64a6f44138d?d=identicon&s=25 Sylvestre Mergulhão (Guest)
on 2007-05-15 13:47
(Received via mailing list)
> When children are asked for a page part, say 'body', they would first look for 'body_en' 
and only revert to 'body' if that does not
> exist.
> So you'd have a single tree of pages, but they would be served through different urls:
> /en/books
> /de/books
> /fr/books

I think its a interesting point of view. So all your pages have parts
for all the languages that your site supports.

In the request you can get the browser default language, dont you? So
the default language of the site will be the browser's default. After
the page is loaded, the user can select an specific language in the
litle flags :).

Probably I will need something like this in a close future. It's ok to
implement this as an extension??

This topic is locked and can not be replied to.