Copied to clipboard

Flag this post as spam?

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


  • Rick 36 posts 150 karma points
    Dec 17, 2014 @ 22:11
    Rick
    1

    Razor in U7...Am I just over tired?

    Hey everyone,

    Bringing up a new site in U 7.2.1 (my first under U7, but not my first Umbraco site) and I'm a bit confused. I've built several sites under u4/6 and have been using razor for quite some time but I'm at a loss with it under U7.

    When I go to the developer section, I don't see a top-level directory for Scripting Files folder for my razor scripts. The Macro's section still has the option razor script under "choose a file to render", but I'm not sure where its pointing to.

    Did I just mis something in the (admittedly lightly skimmed) release notes where it says where I should be putting my razor scripts, did it totally get depreciated for the partial views, or do I just have a borked installtion that is missing something?

    Can someone point me in the right direction, please?

    Thank you in advance,

    Rick

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Dec 17, 2014 @ 22:48
    Dennis Aaen
    9

    Hi Rick,

    The reason why you don´t see the a top-level directory for Scripting Files, is becuase it was for the old dynamicNode razor files, and the dynamicNode Razor is an old legacy razor implementation, and it´s is deprecated. Instead you should use partial views or partial view macros

    And you can use the dynmaic version of Razor or the strongly typed version. You can read more about the dynamic version here http://our.umbraco.org/documentation/Reference/Templating/Mvc/views#Renderingafieldusing@CurrentPage%28dynamically%29, and about the strongly typed Razor here: http://our.umbraco.org/documentation/Reference/Mvc/partial-views#StronglytypedPartialViews

    So when you are using the Umbraco 7.2.1 you need to convert your old dynamicNode razor scripts to partial views or partial view macros. It is not so hard to convert it. the @Model, is @CurrentPage in the dynamic Razor and in the stongly typed version @Model is @Model.Content. you can see more about converting legacy Razor MacroScript to partial view macros here http://our.umbraco.org/documentation/reference/templating/macros/Partial-View-Macros/#ConvertingaPartialViewMacrofromalegacyRazorMacroScript

    So your installation is not missing the Scripting Files folder.

    Hope this can throw some light on why Scripting Files folder is not there any more.

    /Dennis

  • Rick 36 posts 150 karma points
    Dec 17, 2014 @ 22:52
    Rick
    0

    Dennis,

    Thank you for pointing me in the right direction! I don't care to admit how long I crawled through my installation wondering what I did wrong...

    Rick

  • Kasper Dyrvig 246 posts 379 karma points
    Dec 18, 2014 @ 09:12
    Kasper Dyrvig
    0

    Thank you Dennis for your post! I have also searched the entire world wide web (feels like it) to find info on this subject. I do think the official sources have been vague in providing a clear statement of what was happening with Razor vs. Partial Views...

    So you just saved my day :D

  • Balbir 10 posts 52 karma points
    Mar 23, 2015 @ 13:01
    Balbir
    0

    thanks for the guidance :)

  • Meni 277 posts 534 karma points
    Apr 10, 2016 @ 16:47
    Meni
    0

    Hey, couldn't understand where I can find the "old" scripts in order to create the new ones under the MVC macros? Is there any guide? Like, where can I find the "old" code? After creating the new scrips - should I delete the old scripts?

Please Sign in or register to post replies

Write your reply to:

Draft