Could someone help me clarify when to use the following (they all look similar to me and confusing):
- Item Rendering
- View Rendering
- Controller Rendering
- Method rendering
- XSLT Rendering
- Rendering parameter
- Any others
Could someone help me clarify when to use the following (they all look similar to me and confusing):
Item Rendering
This is a way to ask a piece of content (an item) to render itself. The content carries information about how it should render.
To the best of my knowledge this is not widely used and not well documented - but I believe the feature itself to pre-date Sitecore MVC.
View Rendering
Basically this is a Razor view. Sitecore provides a default controller and model for the view. The model can be customised by changing the mvc.getModel pipeline.
Use this when you want to render item content that does not require any significant business or presentation logic.
Controller Rendering
With a controller rendering you supply controller, model and view. On your rendering definition item you specify what action Sitecore should use to render the component.
Use this when you need to render content that relies on external data and/or requires significant business or presentation logic. Anything to do with form submission would probably also fall in this category.
Method Rendering
Will output the return value of a call to a static method.
To the best of my knowledge this is not widely used and not well documented - I suppose it could be used for integrating legacy content.
XSLT Rendering
Renders a Sitecore XSLT on a Sitecore MVC page. This rendering type fills the same space as the View Rendering just using XSLT as the template engine (rather than Razor).
Use this if you have a library of existing Sitecore XSLT components that you don't want to rewrite. Personally I think View Renderings for doing no/low logic components are more appropriate if starting from scratch.
Url Rendering
Renders the response of a HTTP GET request onto the current page.
Use this if you need to screen scrape HTML of another system. Again this could be used as a transition tool when migrating a legacy site. Can be used in some cases to avoid the embarrassing iframe syndrome.
Rendering Parameter
This is not a rendering type and does not provide a facility for rendering anything on its own. Rendering Parameters are used to control the behaviour of renderings. Applies to all of the above rendering types.
Hope this will help.
Try reading this reference on Sitecore Presentation component Reference
Read section 2.4 Renderings and it should enlighten you on all aspects of renderings.
© 2022 - 2024 — McMap. All rights reserved.