just as I would with macro or partial view or a pr...
# package-development
s
just as I would with macro or partial view or a propertyeditor like righ content
d
Hi there! You should be able to use your razor view just like a view in your web project. So if in your RCL, you have a view like this:
Views/Partials/MyExamplePartial.cshtml
You should simply be able to reference it in a template like this:
Copy code
<partial name="MyExamplePartial" />
s
Sometimes it is too easy 🤣
Thank you very much
Is it then still needed to put the view and render in the package manifest?
d
I don't think you ever need to reference a razor template in a package manifest
s
To explain we need to port some modules from different cms to umbraco so trying to figure out how packages work in umbraco. Most docs or samples i see have view pointing to a html i assume for the config part in backoffice and a render set to a cshtml and i assumed that would be for end user / website visitor
And from my questions you will see i am new to umbraco so please bear with me 😇
d
Straight into the deep end, I see 😅 . I'm not sure what you need, but this is the difference in short: The backoffice is rendered as an AngularJS app. The package.manifest tells the angularjs app which extensions exist, so your 'partials' are html views. These views are likely linked to an AngularJS controller that manipulates data and stores it somewhere in the backend (database, filesystem, etc.) using an API endpoint. When you request a content page, you render your response with razor, with ASP.NET mvc, with C#, so you need to use C# to read from your storage and print it inside a razor partial. It is not related to the backoffice and therefore not related to package.manifest.
s
Hi, Things are becoming more clear to me. Thank you all. There is however 1 thing that is unclear and I cannot find any good documentation on it. So the RCL project is setup as projectname/wwwroot/App_Plugins/projectname/Views/Partials/ < here I put the cshtml file The Umbraco site in Visual Studio references the project and I see it automatically with installed packages. So looks good. However if I place it like you said as <partial in the page template I get the error that Umbraco is searching for the partial in a couple of locations but my partial is not found
d
That seems off, I don't expect your partial to be inside App_Plugins. I expect your project file structure to look more like this:
Copy code
root
- wwwroot
  - App_Plugins
    - [Your plugin]
      - package.manifest
      - [javascript, html and css files]
- Views
  - Partials
    - YourPartial.cshtml
s
tried that both but same. I must be doing something right. should this be copied manually into the umbraco website project? even with RCL?
InvalidOperationException: The partial view 'Index1' was not found. The following locations were searched: /App_Plugins/Views/Render/Index1.cshtml /App_Plugins/Views/Shared/Index1.cshtml /App_Plugins/Views/Partials/Index1.cshtml /App_Plugins/Views/MacroPartials/Index1.cshtml /Views/Index1.cshtml /Views/Shared/Index1.cshtml /Views/Partials/Index1.cshtml /Views/MacroPartials/Index1.cshtml /Views/Render/Index1.cshtml /Views/Shared/Index1.cshtml
I must do something wrong
And should eventually when you install package (auto because rcl is referenced) right should the partials be visible in the Umbraco Settings part of the backoffice just like blocklist and grid partials?
Maybe someone knows of a good open source or sample module RCL for Umbraco with both backoffice and some frond end cshtml views/pages/partials ?
Maybe if I compare I can see what I am doing wrong. It can also be that I not yet understand Umbraco good enough and just my concept is wrong
referenced from my umbraco site project and backoffice part works fine
And here all works fine
So this is a good example
of what I want to do
upgraded the project from core 5 to 7
and this is exactly what I need
Now I can go to next step.
property type is added to property and added to my document type homepage
in content the editor can now set a value (content)
last part remaining is now reading that set value in my partial and using EF to select from custom tables and render to the page