Create MVC page template from existing database template

Posted by svict4 on 01-Aug-2019 01:00

Hey should be another relatively easy one.

I've got an existing template (lets call it Master) that has been completely created through Sitefinity Design => Page Templates => Create Templates and dragging and dropping widgets.

I want to create a new code-based (MVC?) page template (lets call it child), based off that template.

I've gone through a lot of the docs, obviously there's a number of ways to create a layout and template, and I'm feeling more lost.

https://www.progress.com/documentation/sitefinity-cms/for-developers-create-page-templates
https://www.progress.com/documentation/sitefinity-cms/create-page-templates
https://www.progress.com/documentation/sitefinity-cms/for-developers-create-mvc-page-templates-based-on-layout-files
https://www.progress.com/documentation/sitefinity-cms/for-developers-base-mvc-page-templates-on-layout-files

Maybe I even need to export the template?

But I think that first link is what I want. 
If that's the case, where do I put the CreatingPageTemplate.cs file.
Would I also then create the new cshtml in the usual mvc/views/layouts folder?

All Replies

Posted by jread on 01-Aug-2019 01:16

The typical process for creating a page template would start in a ResourcePackage folder, ie. ~/ResourcePackages/{YOURNAME}/Mvc/Views/layouts/{name}.cshtml

you can create multi areas within that layout file for the page template editor(admin portal) to recognize as a droppable area with the @Html.SfPlaceholder("")

once this file is created when you load the page template screen (admin portal) you will have that blank template, drop and drop your widget where needed or layour grids.  

You can then use that template as 'master' withing the sitefinity page template area, create a new template 'child' as use the 'master' as the base.

Now every time you use the layout file from that resource package folder it will use all the widget templates available in the /Views/{ContentType}/List.{NAME}.cshtml or Detail{NAME}.cshtml

This thread is closed