Alex Wayne wrote:
> I have a simple extension with a controller that I want to be publicly
> accessible.  The problem is that when I access it, it uses the admin
> layout.  How do I get the views from my controller to render in the my
> site layout as defined by the "Layouts" tab?
> 
> It seems to work just fine otherwise, but obviously, the admin layout is
> not something I want to show to the public.

After some hacking and reverse engineering the Radiant rendering code, I 
managed to come up with this rediculous hack:

  http://pastie.caboo.se/206357

That is probably just about the ugliest thing ever.  I tried doing a:

  @page.parts.new(:name => 'body', :content => render_to_string)

But that just left me with blank content.  So gsubbing the <r:content /> 
tag for the actual rendered template was the next best thing.

Maybe I am completely missing the radiant golden path here.  Should I 
write some radius tags that will let me access this data in a page 
object instead?  If so, how do I access the params[:id] in order to 
retrieve the right objects from the database?  And how do I make a page 
render for a URL with a variable parameter?

Perhaps, I should create a page object via the admin with HTML, title, 
layout, etc.  Then set it up with a specific slug I can easily retrieve. 
Then render that page with my own render_to_string as the body page part 
content?  Still seems weird to manually mess with a page object here to 
achieve what seems to be a simple thing.
-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
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