inställningar
start
employee_1
start
filer
employee_1
Contributors:
  • Klobber
Last edited: 2023-01-19

View structure

Every component/template added to the Easyweb studio can either be rendered inline, in a view you are already coding in, such as Home.cshtml, or rendered as a partial view that can be reused.

Usage

The Easyweb.site-template will search for views to use based on the module and view belonging to the page being called. This applies to both the main view, as well as templates used in the view, which can however search additional locations per type.

The following search paths will always be searched:

/Views/[ModuleKey]/{0}.cshtml
/Views/{0}.cshtml
/Views/{1}/{0}.cshtml
/Views/Shared/{0}.cshtml
/Views/_Default/{0}.cshtml

{0} = Key variant for view or template type
{1} = Controller (only used when implementing own controller)
Views (index.cshtml/[CustomKey].cshtml)
Main view (view called with @RenderBody() from _Layout) for a call searches the above locations for a view with the CustomKey for the view, the regular key for the view, or Index.cshtml

If you create a separate view under pages for contact with the key "Contact", Contact.cshtml will be searched.

For regular keys, folders will search for the name Folder.cshtml, a module homepage for Module.

If nothing is found, Index.cshtml is always searched for.

Templates (e.g. sections/groups)

For templates, the search paths will be searched, with the addition that the folder with the same type as the templates will be searched.

For example, if you have a ReferenceType.Image, the ReferenceType folder will be searched through each search path.

Regarding the name of views, several different combinations of the key will be searched. The following names will be searched in the following order:

[Path]\[Key].[CustomKey].cshtml
[Path]\[Type]\[CustomKey].cshtml
[Path]\[CustomKey].cshtml
[Path]\[Type]\[Key].cshtml
[Path]\[Key].cshtml

Example for ReferenceType.Image with its own key (CustomKey) "hero-image":
[Type] = "ReferenceType"
[Key] = "Image"
[CustomKey] = "hero-image"
Easyweb icon

This website uses cookies to improve your user experience, for security routines and for statistics. By continuing to use the website, you agree to the use of cookies.

Feel free to read ours privacy policy. If you agree to our use, choose Accept all. If you want to change your choice afterwards, you will find that option at the bottom of the page.

Cookies