Is there any way to use placeholder similar to WebForms in NVelocity View Engine (.v开发者_如何学Gom files)?
Today I've got a component containing everything for the <head>
, but I wish to specify additional tags from each view page like it can easily be done in ASP.NET WebForms / MVC:
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server"></asp:Content>
If this is not possible directly trough NVelocity View Engine, do I have any other alternatives other than using a blank MasterPage and adding all markup in each view page?
In your layout, specify a variable. This will act like your content place holder:
$!header
Then in your page, you can specify content for that:
#capturefor(header)
<b>html for my header</b>
#end
I hope you already found that answer! But just in case, and for anyone looking, there you have it.
精彩评论