intellij 아이디어를 사용하여 스칼라에서 간단한 웹 템플릿을 업로드했습니다. 어떻게 다른 파일에서 내가 index.scala.html 이 각 함수를 호출하고 를 각 섹션을 호출하는 것은에서 @services
을 각 기능을하는 방법을 위의 코드로 내 main.scala.htmlIntellij 아이디어를 사용하여 페이지를 동적으로 재생하는 방법
<html>
<body id="page-top" class="index">
@navigation
@header
@services
@portfolio
@about
@team
@client
@contact
@footer
</body>
</html>
입니다 별도 파일 인 @portfolio
. 이 내 index.scala.html
@(message: String)
@navigation = { navigation html code}
@header = {<header> html code</header>}
@services = {
<section id="services"><!--html code for reference-->
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading">Services</h2>
</div>
</div>
<div class="row text-center">
<div class="col-md-4">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x text-primary"></i>
<i class="fa fa-shopping-cart fa-stack-1x fa-inverse"></i>
</span>
<h4 class="service-heading">E-Commerce</h4>
</div>
<div class="col-md-4">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x text-primary"></i>
<i class="fa fa-laptop fa-stack-1x fa-inverse"></i>
</span>
<h4 class="service-heading">Responsive Design</h4>
</div>
<div class="col-md-4">
<span class="fa-stack fa-4x">
<i class="fa fa-circle fa-stack-2x text-primary"></i>
<i class="fa fa-lock fa-stack-1x fa-inverse"></i>
</span>
<h4 class="service-heading">Web Security</h4>
</div>
</div>
</div>
</section>
}
@main("hello test")(navigation)(header)(services){ }
내 응용 프로그램 패키지 컨트롤러
import play.api._
import play.api.mvc._
object Application extends Controller {
def index = Action {
Ok(views.html.index("Ok"))
}
}
내가 같은 파일에있을 헤더를 원
GET / controllers.Application.index
내 경로입니다., @services을 @ 포트폴리오를 서로 다른 여러 파일로 분리하여 하나의 페이지 웹 페이지로 동적으로 호출 할 수 있습니다.
찾기. 함수 내비게이션, 헤더 및 기타가 객체 인덱스 적용 메소드 내에서 선언 된 것을 볼 수 있습니다. 그래서 접근 할 수 없습니다 (심지어 반사에 의해서). 아래 내 대답을 참조하십시오. –