Is there any way to use placeholder similar to WebForms in NVelocity View Engine (.vm 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.