moreScript / moreStylesheet in scala templates

158 views
Skip to first unread message

Drew Hamlett

unread,
Oct 3, 2011, 3:25:27 PM10/3/11
to play-framework
How would I do this?


@(title:String = "Main")(body: => Html)(script: => Html)

<!DOCTYPE html>
<html>
<head>
<title>@title</title>
<link rel="stylesheet" media="screen" href="@asset("public/
stylesheets/main.css")">
<link rel="shortcut icon" type="image/png"
href="@asset("public/images/favicon.png")">
<script src="@asset("public/javascripts/jquery-1.5.2.min.js")"
type="text/javascript"></script>
</head>
<body>
@body
</body>

@script

</html>


I want to add a script part at the bottom of the page. I can't seem
to get the syntax right.


@(message : String)

@main("Index") {

Hello

@message



}

@script {

}



This is not working. Thanks for any help.

Kitora, Naoki

unread,
Oct 3, 2011, 7:06:47 PM10/3/11
to play-fr...@googlegroups.com
for example:


@(title: String = "Main", script: => Html = Html(""))(body: => Html)

<!DOCTYPE html>
<html>
  <head>
   <title>@title</title>
   <link rel="stylesheet" media="screen"

href="@asset("public/stylesheets/main.css")">


   <link rel="shortcut icon" type="image/png"
href="@asset("public/images/favicon.png")">
    <script src="@asset("public/javascripts/jquery-1.5.2.min.js")"
type="text/javascript"></script>
  </head>
  <body>
   @body
  </body>

  @script

</html>

----------------------------------------------------------------------

@(message : String)

@main("Index",
Html("""<script src="some.js" type="text/javascript"></script>""")) {

       Hello

       @message
}


--
Kitora, Naoki <naoki....@gmail.com>
twitter: http://twitter.com/kitora_naoki

Drew Hamlett

unread,
Nov 30, 2011, 10:44:41 AM11/30/11
to play-framework
Thanks. Is there a better way to do this now with Play 2.0.?

> Kitora, Naoki <naoki.kit...@gmail.com>
> twitter:http://twitter.com/kitora_naoki

Reply all
Reply to author
Forward
0 new messages