Copied to clipboard

Flag this post as spam?

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


  • Biagio Paruolo 1621 posts 1914 karma points c-trib
    Mar 09, 2011 @ 09:21
    Biagio Paruolo
    0

    Razor and template/umbraco lib/Visual Studio...

    Hi,

    I'm testing Razor in 4.7RC and I've some questions.

    1) In Razor template is possibile to use Umbraco Library as into XSTL?

    2) Is the best solution to use macro or razor script into template?

    3) How is possible to write code with Vs2010 and put into Umbraco without DLL, but use Vs2010 intellisense and reference to Umbraco Libraries?

    4) Template toolbar: Razor macros are listed in macro button and not in Razor template button. Why?

    Thank you

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Mar 09, 2011 @ 10:44
    Sebastiaan Janssen
    0

    1) Yes, just do the same, but with a dot instead of a colen - umbraco.library.NiceUrl(nodeId);

    2) What works best for you is best. Personally, I like seperating concerns and most work in external cshtml files and with helpers that get put into App_Code

    3) Yes. You can add references in web.config (compilation / assemblies). For more intellisense add an @using umbraco.MacroEngines; and cast Model to a DynamicNode

    4) Because a macro is not a razor template :-) Razor templates are built in. Macros are blocks of functionality that you create yourself.

  • Biagio Paruolo 1621 posts 1914 karma points c-trib
    Mar 09, 2011 @ 12:58
    Biagio Paruolo
    0

    Thank you for your reply.

    Is there an example for 1,2 and 3?

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Mar 09, 2011 @ 17:26
    Sebastiaan Janssen
    0

    2 and 3 are just default functionality of Visual Studio really, so I'm sure that google is your friend. 

    Example for number 1 is simple:

    <a href="@umbraco.library.NiceUrl(Model.Id)">Link to current page</a>

    Have a look at my blog posts on the subject as well.

  • Biagio Paruolo 1621 posts 1914 karma points c-trib
    Mar 09, 2011 @ 19:44
    Biagio Paruolo
    0

    for 2 and 3 respect to Umbraco... 1 is simple -:)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

    Continue discussion

Please Sign in or register to post replies