GET parameters and behaviors

Is there away to access GET parameters in a behaviour?
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

David wrote:

Is there away to access GET parameters in a behaviour?
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

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

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


John L.
http://wiseheartdesign.com

Hi,

Would somebody please give me a step by step, detailde guide to install
Radiant at 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

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

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. :slight_smile:

Cheers,
David

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

Is there away to access GET parameters in a behaviour?
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

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 :slight_smile:
*Mars

( <> … <> )

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
for a
detailed explaination.

http://www.hostingrails.com/forums/wiki_thread/18