Dashboard > FreeMarker > Home > page_layout
FreeMarker Log In | Sign Up   View a printable version of the current page.
page_layout
Added by Jeff Ferber, last edited by Jeff Ferber on Jul 20, 2006

Here's a 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" href="/layout/favicon.ico" />

	<!-- FIXME: -->	<#assign path = actionBean.contextPath >
			
	<#list js as file>   		
		<script type="text/javascript" src="${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: 1.4.2 Build:#214 Jun 30, 2005) - Bug/feature request - Contact Administrators