I am a big fan of NVelocity. I think its terse syntax is a huge boon, and helps keep my views simple and effective. I have begun using the NVelocity view engine from the Mvc Contrib project for ASP.NET MVC, along with the Castle NVelocity .vm syntax highlighter.
While I love what NVelocity brings to the table, I am really missing one feature of ASP.NET .aspx views that I find immensely useful: Master Pages.
Does anyone know if there is an NVelocity view engine for ASP.NET MVC that provides Master/Child pages like classic .aspx views? Does the MVCContrib project from Codeplex support this (at the moment there is a total void of documentation for the MVCContrib NVelocity view engine.)
Any help is greatly appreciated.
Well, as it turns out, the NVelocity View Engine for ASP.NET MVC does have some basic master/child content capabilities. There is a simple #parse() command that may be used to render child views...when used with the $childContent template variable, a simple master/content page relationship is born:
<head>
<title>My Page with Master Page</title>
<link href="$Url.Content('~/Views/Common/Site.css')" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
#parse("shared/header.vm")
</div>
<form>
<div id="content">
#parse($childContent)
</div>
<div id="footer">
#parse("shared/footer.vm");
</div>
</form>
</body>