开发者

how do you override the rendering of the Navigation zone in Orchard CMS?

开发者 https://www.devze.com 2023-03-08 22:43 出处:网络
I\'m new to Orchard, so I probably have no idea what I\'m doing. I\'ve figured out how to override different shapes but putting a cshtml file in the View folder with the same name as the shape.

I'm new to Orchard, so I probably have no idea what I'm doing.

I've figured out how to override different shapes but putting a cshtml file in the View folder with the same name as the shape.

Also, I found the Menu and MenuItem shape cshtml files unde开发者_高级运维r the Core Orchard files.

However, I don't see a shape named Navigation and I don't really understand how Zones work.

I searched the code and couldn't figure out exactly how the Navigation is rendered, though I did find some of the code.

The reason that I want to override the Navigation rendering is that it renders a DIV and a NAV tag around the UL. I would prefer to just render the NAV and UL.


Zones are also shapes, but they are declared in code (Core/Shapes/CoreShapes.cs), not in .cshtml files like most of shapes. Also, there is no shape called Navigation, as zones are created dynamically at runtime - names of those are provided by the theme used.

Zones have default alternates in the form Zone__[ZoneName]. It means you just need to put Zone-Navigation.cshtml file in /Views folder in your theme folder to override Navigation zone rendering.


If you are using the latest 1.1.3 release you can use the new shape tracing tool from the designer tools module. It provides a list of URL alternates to name your template in order to override the default rendering.

0

精彩评论

暂无评论...
验证码 换一张
取 消