Subtemplating with ERB

In rails the concept you are looking for is a partial template. As usual there are conventions to follow.

Partials have file names starting with an underscore. So the filename would be _subtemplate.rhtml rather than just subtemplate.rhtml.

Then:

<%= render :partial => 'subtemplate' %>

where you want to include it.

> Hey! > > I'm using Ruby withour Rails, but i make use of the ERB-template > functionality. So i think is a good place to post this one here. > > I want to do subtemplating, is that possible?

[...]

In rails the concept you are looking for is a partial template. As usual there are conventions to follow.

Partials have file names starting with an underscore. So the filename would be _subtemplate.rhtml rather than just subtemplate.rhtml.

Then:

<%= render :partial => 'subtemplate' %>

where you want to include it.

Christian, you are better off asking this on the ruby-talk mailing list rather than on the Rails list, since you are much more likely to get help with a non-Rails use of ERB. You're probably going to mostly get responses that talk about render :partial, as above, on this list.

Rick DeNatale

--Greg