F
Frank Reiff
Hi,
I use ERB for some very basic HTML templating (no Rails!). In essence, I
have normal HTML pages produced by Adobe GoLive (the WORST HTML editor
ever) with a couple of simple tags along the lines of <%=
@myProduct.price %>.
Now, I'm planning to replace GoLive's templating mechanism with ruby.
Ideally, the solution would look something like this:
* each file is a simple HTML file that remains editable in a normal HTML
editor, e.g.
<html>
<body
<p>Hello World</p>
</body>
<html>
* the template itself is an HTML file that remains editable in a normal
HTML editor, something along these lines:
<html>
<header><%= headertag() %></header>
<body
<div id="content">
<%= content() %>
</div>
<div id="navigataion">
<%= navigation() %>
</div>
</body>
<html>
Looking at the documentation for the ERB class, I can't find a simple
way of including another template inside a template file. I guess I
could simply do a require, but that will simply copy the entire contents
of the file as ruby code. How do you usually subdivide your templates
into multiple files (e.g. header, variable content, footer, etc.) using
ERB?
Are there any better templating solutions available that could deal with
combining multiple HTML pages into a single one?
Any help would be appreciated.
Best regards,
Frank
I use ERB for some very basic HTML templating (no Rails!). In essence, I
have normal HTML pages produced by Adobe GoLive (the WORST HTML editor
ever) with a couple of simple tags along the lines of <%=
@myProduct.price %>.
Now, I'm planning to replace GoLive's templating mechanism with ruby.
Ideally, the solution would look something like this:
* each file is a simple HTML file that remains editable in a normal HTML
editor, e.g.
<html>
<body
<p>Hello World</p>
</body>
<html>
* the template itself is an HTML file that remains editable in a normal
HTML editor, something along these lines:
<html>
<header><%= headertag() %></header>
<body
<div id="content">
<%= content() %>
</div>
<div id="navigataion">
<%= navigation() %>
</div>
</body>
<html>
Looking at the documentation for the ERB class, I can't find a simple
way of including another template inside a template file. I guess I
could simply do a require, but that will simply copy the entire contents
of the file as ruby code. How do you usually subdivide your templates
into multiple files (e.g. header, variable content, footer, etc.) using
ERB?
Are there any better templating solutions available that could deal with
combining multiple HTML pages into a single one?
Any help would be appreciated.
Best regards,
Frank