velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Praveen Ray <praveen...@yahoo.com>
Subject calling same macro in multiple pages
Date Wed, 19 Oct 2005 02:31:13 GMT
Hi All
I'm trying to abstract the common layout in one .vm file
like this:

layout.vm:
-----------
<html>
<body>
<div> #parse( "header.vm" ) </div>
<div> #body() </div>
<div> #parse( "footer.vm") </div>
</body>
</html>

homepage.vm
-----------
#macro( body )
This is Home Page
goto <a href='/myinfo'>My Info</a>
#end
#parse( "layout.vm")

myinfo.vm
---------
#macro( body )
This is My Info
#end
#parse( "layout.vm")


As you can see the general layout of the site has been
abstracted into layout.vm and each individual template is 
just generating the content for the main body. Although
nice scheme, this doesn't work. The homepage displays
properly, however clicking on 'My Info' link on the home,
takes you a screen which has same content as the body of
the homepage. It's, as if, the #body macro from homepage is
used to render myinfo page. Looks like similar named macros
from different pages are not unique?

Is this kind of stuff even doable in Velocity? If yes, what
am I doing wrong? If not, can someone please suggest an
alternate way of abstracting the layout in one file?
Thanks


  - Praveen  


	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message