Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dibs 202 posts 991 karma points
    May 16, 2017 @ 15:37
    Dibs
    0

    Create local navigation with custom controllers, Model & View

    Hi Umbraco Team

    I would like to create local navigation via C# MVC framework instead of using OOTB Razor sytnax in Umbraco views.

    Not upto speed with MVC, could someone advise/hint how to go about creating navigation viaMVC ?

    Thanks Dibs

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    May 16, 2017 @ 15:38
    Alex Skrypnyk
    0

    Hi Dibs

    What wrong with Umbraco way of doing navigation?

    You can do the same via MVC, just create a model with navigation data, a surface controller for filling the model and view for rendering.

    Thanks,

    Alex

  • Dibs 202 posts 991 karma points
    May 16, 2017 @ 15:47
    Dibs
    0

    Hi Alex

    I have read for larger sites each page view loops through all pages and could slow page rendering. Also, have logic in controller and only render data in view.

    Dibs

  • John Bergman 483 posts 1132 karma points
    May 16, 2017 @ 19:23
    John Bergman
    0

    Hi Alex,

    While it is true, that looping through all of the pages could slow your site down, one thing we have done in the past is cache the results so that you only need to loop through the site when the cache is dirty (you can catch content save events to mark it as dirty), or when the site starts up.

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    May 16, 2017 @ 21:42
    Alex Skrypnyk
    0

    Hi John and Dibs

    We are using caching all the time, it's really amazing thing for navigation and stuff like that, Umbraco CachedPartial helper is really useful. So we don't use pure MVC controllers for navigation.

    Thanks,

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft