I've had a problem reoccuring in a couple of extensions and was not
sure if it was a conceptual error on my side or if something was
lacking in Radiant's tag system. I solved this problem now and wanted
to share it to get some feedback from you guys.

Take the 'url' tag from the standard tags for example. It tries to
access the request object through tag.globals.page.request.
Now this works fine if you render a page using the SiteController. But
when you have an extension that uses its own controller and renders
the page by calling 'render :text => @page.render',
tag.globals.page.request is nil.
I solved this problem by defining a filter in the
ApplicationController that sets @page by looking at params[:url] and
then sets @page.request (and @page.response). This way
tag.globals.page.request is always available, no matter if you use
your own controller or not.

I hope this explanation was somewhat understandable.
Do you guys think this is a good idea or do you see any problems?

Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to