Dashboard > Stripes > ... > User Additions > Page Layout Template
Stripes Log In   View a printable version of the current page.
Page Layout Template
Added by Jeff Ferber, last edited by Tim Fennell on Aug 02, 2006  (view change)

Stripes has moved! This site is no longer being actively maintained. Please point your browsers at http://www.stripesframework.org and update your bookmarks. Thank you.

Here's a FreeMarker macro that you can use to apply a standard layout to your pages. For parameters, it can optionally handle a title, css and javascript includes, and a passthrough for meta tags or whatever else you want in the HEAD section of the page.

note: you'll need to change the context path. (See <#assign path = actionBean.contextPath >") The way I'm doing it is probably dumb and likely won't work in your setup.

example webpage using the macro
<@page
	title="your page title"
	css=["/layout/css/default.css", "/layout/css/foo/foo.css"]
	js=["/layout/js/prototype/prototype.js", "/layout/js/foo/gratuitousUseOfJavascript.js"]
	other=[perhapsMoreJavascriptFromAnAssignTag]
 >
	...page content...
</@page>

 

the page layout macro
<#macro page title="DefaultTitle" css=["/layout/css/base.css"] js=[] other=[]>
   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

   <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

   <head>
      <title>${title} - YourCompanyName or Whatever</title>
      	<link rel="shortcut icon" xhref="/layout/favicon.ico" />

	<!-- FIXME: -->	<#assign path = actionBean.contextPath >

	<#list js as file>
		<script type="text/javascript" xsrc="${path}${file}"></script>
      	</#list>

	<#list other as passthrough>
      		${passthrough}
      	</#list>

	<#list css as file>
      		<style type="text/css" media="all">@import ${path}${file};</style>
      	</#list>

   </head>

   <body>
	   <div id="contentBody">
	      <#nested>
	   </div>  <!-- end contentBody -->

	   <div id="footer">
	   		Copyright &copy;2006 YourCompanyName, Inc. or whatever footer you want
	   </div>
   </body>
 </html>
</#macro>

 

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.7 Build:#524 Jul 28, 2006) - Bug/feature request - Contact Administrators