【发布时间】:2010-11-23 08:44:00
【问题描述】:
我有一堆共享相同页眉和页脚的静态 html 文件。一世 想在所有页面上共享此页眉和页脚。现在我 使用以下路由但它有点难看,我必须处理所有特殊情况。有没有简单的方法,比如 php 的 include 函数?
(defroutes my-app
(GET "/"
(html-with-template
"main.header" "index.body" "main.footer" ))
(GET "/*.html"
(html-with-template
"main.header" (str (params :*) ".body") "main.footer" ))
(GET "/*/"
(html-with-template
(str (params :*) "/folder.header")
(str (params :*) "/index.body")
(str (params :*) "/folder.footer")))
(GET "/*"
(or (serve-file (params :*)) :next))
(ANY "*"
(page-not-found)))
【问题讨论】:
-
例如前 2 条路由 / 和 /*.html 它们都路由到 index.html 但我必须保留两条路由。