Reputation: 1573
Our group needs to have a standard Common Look and Feel (CLF) for all our web applications. the base line for them all is the same, and certain items like the css references can have customization.
We want to find a way to create either one full layout file or partials that can be shared by all.
I have read many postings and the layout variable on views do not have the ability to read absolute paths.
Can we get a razor method to read XML and render to our layouts, much like the renderbody() does?
EDIT: We would like to have items like the css, standard layouts etc in one project. Then this could become a distributable package for development teams.
Example of the final output we are looking for:
_base.cshtml example.
@model CLFModel
@CLF.Header(...)
@CLF.LeftMenu(...)
@CLF.OptionalRightMenu(...)
@CLF.Body(...)
@CFL.Footer(...)
The CLF.Header would contain something like below, and would be render from either a file or a pre compiled reference.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="@Model.dcLanguage" lang="@Model.dcLanguage">
<head>
<meta charset="utf-8" />
<title>@Model.PageTitle</title>
meta tags.....
CSS required links ....
CSS section for custom link references ...
script tags(required)
optional section for script tags
</head>
Upvotes: 0
Views: 164
Reputation: 13594
You can create as many partial view as you want and just include them into the view you are rendering using @Html.Partial("YourPartialView")
. You can create a _MasteLayout, which contains various partial views and @RenderBody for maintaining a consistent feel
Upvotes: 1