Dashboard > Stripes > ... > User Additions > Page Layout Template
Page Layout Template Log In | Sign Up   View a printable version of the current page.

Added by Jeff Ferber , last edited by Tim Fennell on Aug 02, 2006  (view change)

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>

 

Hosting for this site is donated by the wonderful people at Contegix
Site running on a free Atlassian Confluence Open Source Project License granted to Stripes Framework. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.6.2 Build:#919 Nov 26, 2007) - Bug/feature request - Contact Administrators