On 11:00 Fri 11 Feb , Carl Youngblood wrote:> I''m not sure what variables are available to me during the
rendering of
> the default layout, scaffold.rhtml. I have some pages where I need to
> put javascript in the head section of the HTML. What is the
"rails" way
> to do this?
You can assign the javascript to an instance variable, and then
reference that instance variable in the layout:
my_template.rhtml:
<% @jscode = "blah blah blah" %>
scaffold.rhtml:
<head>
<script lang="javascript">
<%= @jscode %>
</script>
</head>
This lets you do lots of cool things, like creating a tabbed
interface. Each tab is rendered in the layout template, but the active
tab is specified by the individual template that is rendered.
- Jamis
--
Jamis Buck
jamis_buck-8Bzd4dk9+oo@public.gmane.org
http://jamis.jamisbuck.org
------------------------------
"I am Victor of Borge. You will be assimil-nine-ed."