Erubis subtemplates

Is it possible to do subtemplating with erubis?

I achieved similar behaviour with ERB the following way:

template = ERB.new(File.read(‘template.rhtml’))

— in the template i put the following code

<%= ERB.new(IO.read('subtemplate1'), nil, nil, '_sub1').result(binding()) %> <%= ERB.new(IO.read('subtemplate2'), nil, nil, '_sub2').result(binding()) %>

page = template.result(binding())

As a result i get all templates mixed together.

How do i do that with erubis?

Christian K. wrote:

Is it possible to do subtemplating with erubis?

I achieved similar behaviour with ERB the following way:

template = ERB.new(File.read(‘template.rhtml’))

— in the template i put the following code

<%= ERB.new(IO.read('subtemplate1'), nil, nil, '_sub1').result(binding()) %> <%= ERB.new(IO.read('subtemplate2'), nil, nil, '_sub2').result(binding()) %>

page = template.result(binding())

As a result i get all templates mixed together.

How do i do that with erubis?

I’m using tenjin now. It has subtemplating built in.

http://www.kuwata-lab.com/tenjin/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs