Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Erubis subtemplates
Christian Kerth
3/18/2008 8:31:00 AM
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
<html>
<body>
<%= ERB.new(IO.read('subtemplate1'), nil, nil,
'_sub1').result(binding()) %>
<%= ERB.new(IO.read('subtemplate2'), nil, nil,
'_sub2').result(binding()) %>
</body>
</html>
---
page = template.result(binding())
As a result i get all templates mixed together.
How do i do that with erubis?
--
Posted via
http://www.ruby-...
.
1 Answer
Christian Kerth
3/18/2008 3:52:00 PM
0
Christian Kerth 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
>
> <html>
> <body>
> <%= ERB.new(IO.read('subtemplate1'), nil, nil,
> '_sub1').result(binding()) %>
> <%= ERB.new(IO.read('subtemplate2'), nil, nil,
> '_sub2').result(binding()) %>
> </body>
> </html>
>
>
> ---
>
> 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.c...
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Erubis subtemplates
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password