Forum: Ruby on Rails Render layout on the fly

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Franz Bettag (Guest)
on 2006-05-19 02:26
Hi guys,

i was wondering if there is any possibility to render a layout on the
fly instead of putting it into the layouts/ folder. Any ideas?
Alex W. (Guest)
on 2006-05-19 03:16
Franz Bettag wrote:
> Hi guys,
>
> i was wondering if there is any possibility to render a layout on the
> fly instead of putting it into the layouts/ folder. Any ideas?

Not sure what you mean.  Layouts are rendered just like any rhtml file.
Franz Bettag (Guest)
on 2006-05-19 11:41
Alex W. wrote:
> Franz Bettag wrote:
>> Hi guys,
>>
>> i was wondering if there is any possibility to render a layout on the
>> fly instead of putting it into the layouts/ folder. Any ideas?
>
> Not sure what you mean.  Layouts are rendered just like any rhtml file.

Yeah but normal .rhtml files have to be in the layouts folder. I want to
load the layout from another website everytime the shop gets called. So
not store them locally. I know this i quite bw consuming on sites with
many hits but my customer want's it that way :)
Edward Ocampo-Gooding (Guest)
on 2006-05-19 18:57
Franz Bettag wrote:
> Alex W. wrote:
>> Franz Bettag wrote:
>>> Hi guys,
>>>
>>> i was wondering if there is any possibility to render a layout on the
>>> fly instead of putting it into the layouts/ folder. Any ideas?
>>
>> Not sure what you mean.  Layouts are rendered just like any rhtml file.
>
> Yeah but normal .rhtml files have to be in the layouts folder. I want to
> load the layout from another website everytime the shop gets called. So
> not store them locally. I know this i quite bw consuming on sites with
> many hits but my customer want's it that way :)

I took a look at the Rails API and found these examples:

  # Renders the template located at the absolute filesystem path
  render :file => "/path/to/some/template.rhtml"
  render :file => "c:/path/to/some/template.rhtml"

  # Renders a template within the current layout, and with a 404 status
code
  render :file => "/path/to/some/template.rhtml", :layout => true,
:status => 404
  render :file => "c:/path/to/some/template.rhtml", :layout => true,
:status => 404

  # Renders a template relative to the template root and chooses the
proper file extension
  render :file => "some/template", :use_full_path => true

and

  # Renders the template located in
[TEMPLATE_ROOT]/weblog/show.r(html|xml) (in Rails,
app/views/weblog/show.rhtml)
  render :template => "weblog/show"
This topic is locked and can not be replied to.