# GET parameters and behaviors

**URL:** <https://www.ruby-forum.com/t/get-parameters-and-behaviors/68136>\
**Category:** Radiant CMS\
**Created:** [September 9, 2006, 6:27pm UTC](https://www.ruby-forum.com/t/get-parameters-and-behaviors/68136 "2006-09-09T18:27:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 9, 2006, 6:27pm UTC](https://www.ruby-forum.com/t/get-parameters-and-behaviors/68136/1 "2006-09-09T18:27:53Z")

</div>

Is there away to access GET parameters in a behaviour?  
[site.com/something/1](http://site.com/something/1) translates in the behaviour to parameters[:id] â?? it  
dosent have to be like this, just an exampleâ?¦

Of cause at the moment when I punch in URLs like that I get 404 errors.  
Iâ??m sure there would be away to accommodate for that with some messing  
around with routes.rb, but it would kill some of radiants shineâ?¦

Just wondering if there is an easy way that wonâ??t disrupt anything in  
radiant.

Cheers,  
David

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 9, 2006, 7:44pm UTC](https://www.ruby-forum.com/t/get-parameters-and-behaviors/68136/2 "2006-09-09T19:44:45Z")

</div>

David wrote:

> Is there away to access GET parameters in a behaviour?  
> [site.com/something/1](http://site.com/something/1) translates in the behaviour to parameters[:id] â?? it  
> dosent have to be like this, just an exampleâ?¦
> 
> Of cause at the moment when I punch in URLs like that I get 404 errors.  
> Iâ??m sure there would be away to accommodate for that with some messing  
> around with routes.rb, but it would kill some of radiants shineâ?¦
> 
> Just wondering if there is an easy way that wonâ??t disrupt anything in  
> radiant.

Not at the moment. Maybe you could create a plugin?

You do have access to request#params in a behavior, but you can’t do any  
of the routes magic you are talking about.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 10, 2006, 1:43am UTC](https://www.ruby-forum.com/t/get-parameters-and-behaviors/68136/3 "2006-09-10T01:43:44Z")

</div>

Hey,

Could you make a forum for Radiant main site, this mailing list is very  
annoying and fills our inbox… cant you make a phpBB support forum or  
something?

Thanks,  
Richard R

* * *

Need more speed? Get Xtra Broadband @  
[http://jetstream.xtra.co.nz/chm/0,,202853-1000,00.html](http://jetstream.xtra.co.nz/chm/0,,202853-1000,00.html)

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 10, 2006, 1:55am UTC](https://www.ruby-forum.com/t/get-parameters-and-behaviors/68136/4 "2006-09-10T01:55:47Z")

</div>

rreeeee rrffff wrote:

> Could you make a forum for Radiant main site, this mailing list is very  
> annoying and fills our inbox… cant you make a phpBB support forum or  
> something?

There is always ruby-forum:

[http://www.ruby-forum.com/forum/21](http://www.ruby-forum.com/forum/21)

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 10, 2006, 2:01am UTC](https://www.ruby-forum.com/t/get-parameters-and-behaviors/68136/5 "2006-09-10T02:01:49Z")

</div>

Hi,

Would somebody please give me a step by step, detailde guide to install  
Radiant at [Site5.com](http://Site5.com). All i’ve done it downloaded the .tz file,  
extracted it  
and uploaded it into my webhosting account. Im stuck.

Please help?

Thanks,  
Richard R

* * *

Need a new job? Check out XtraMSN Careers [http://xtramsn.co.nz/careers](http://xtramsn.co.nz/careers)

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 10, 2006, 5:23am UTC](https://www.ruby-forum.com/t/get-parameters-and-behaviors/68136/6 "2006-09-10T05:23:52Z")

</div>

MarsHall wrote:

> I recently wrote a Radiant Behavior that uses the GET querystring:
> 
> Simply Get –  
> Takes a querystring ‘q’ and renders the child of this page with  
> matching slug.
> 
> I built it into a Rails plugin, available via http:  
> [http://a3online.com/simply\_get\_behavior.tar.gz](http://a3online.com/simply_get_behavior.tar.gz)

RAD! thanks for the heads up! I’ll try it out later today…

Must be said that the radiant community is ever helpful. Have got many  
good tips from reading all the emails I get off the mail list. Its worth  
the inbox clutter Richard. 🙂

Cheers,  
David

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 10, 2006, 3:27am UTC](https://www.ruby-forum.com/t/get-parameters-and-behaviors/68136/7 "2006-09-10T03:27:57Z")

</div>

On Sep 9, 2006, at 11:27, David wrote:

> Is there away to access GET parameters in a behaviour?  
> [site.com/something/1](http://site.com/something/1) translates in the behaviour to parameters[:id]  
> ? it  
> dosent have to be like this, just an example?

I recently wrote a Radiant Behavior that uses the GET querystring:

Simply Get –  
Takes a querystring ‘q’ and renders the child of this page with  
matching slug.

I built it into a Rails plugin, available via http:  
[http://a3online.com/simply\_get\_behavior.tar.gz](http://a3online.com/simply_get_behavior.tar.gz)

Or, see the following Ruby code \<\<EXAMPLE

class SimplyGetBehavior \< Behavior::Base

register “Simply Get”

description %{  
Takes a querystring ‘q’ and renders the child of this page with  
matching slug.  
}

attr\_accessor :page\_headers

def process(request, response)  
# can’t process query in find\_page\_by\_url since request object  
is not  
# defined at that stage  
query = request.parameters[:q]  
if not query.to\_s.strip.empty?  
@found = false  
@request, @response = request, response  
@query = query.to\_s.strip  
if @matched = @page.children.find(:first, :conditions =\>  
[“slug = ‘%s’”, @query])  
@found = true  
@response.headers[‘Status’], @response.headers[‘Location’] =  
‘302’, @matched.url  
else  
@page = @page.children.find(:first, :conditions =\>  
“behavior\_id = ‘Page Missing’”) || nil  
super  
end  
@request, @response = nil, nil  
else  
super  
end  
end

def cache\_page?  
false  
end

def page\_headers  
if @found  
super  
else  
{ ‘Status’ =\> ‘404 Not Found’ }  
end  
end

end

EXAMPLE

Hope this helps 🙂  
\*Mars

( \<\> … \<\> )

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 10, 2006, 9:24am UTC](https://www.ruby-forum.com/t/get-parameters-and-behaviors/68136/8 "2006-09-10T09:24:21Z")

</div>

does it use cpanel?

if so I may be able to help. delete the .tz file and all thats there  
with it  
and use svn to install radiant. Check out my wiki at [hostingrails.com](http://hostingrails.com)  
for a  
detailed explaination.

[http://www.hostingrails.com/forums/wiki\_thread/18](http://www.hostingrails.com/forums/wiki_thread/18)
