depends on how you mean, you can have a <umbraco:macro runat="server" language="razor"> ... </umbraco:macro> enclose the full template container - and that way have noting but razor building up that template.
You still have to work within the concept of masterpages as templates as Umbraco is still a WebForms based CMS. But as Jonas say, you could just include a razor macro and put everything in there.
I think what Slace was trying to say is that Razor was designed as an ASP.NET viewengine, not as a classic webforms server side control (basically anything that has a runat="server" attribute).
Yes, it does support all of the XSLT extensions. Also, with the .AncestorOfSelf method you can do recursive lookup just fine.
I wouldn't know why you should not do it, if you don't need server side controls then go for it.
Making a Template Using Razor
Can a complete template be created using Razor?
Hi,
depends on how you mean, you can have a <umbraco:macro runat="server" language="razor"> ... </umbraco:macro> enclose the full template container - and that way have noting but razor building up that template.
Regards
Jonas
You still have to work within the concept of masterpages as templates as Umbraco is still a WebForms based CMS. But as Jonas say, you could just include a razor macro and put everything in there.
Example?
<%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
<umbraco:Macro Alias="Test" runat="server"></umbraco:Macro>
</asp:Content>
"Test" is a razor macro.
You can do a whole template in Razor by using inline macros (as Jonas has said). Keep the following in mind:
* Razor wasn't designed for WebForms so the concept of a control does exist. This means that including macros in your Razor 'template' may be tricky
* You'll loose so features like recursive field lookup, default field values and other things you can specify on <umbraco:Item
* This is a theory and not a practice, I don't recommend you do it :P
Hi,
>>* Razor wasn't designed for WebForms so the concept of a control does exist. This means that including macros in your Razor 'template' may be tricky
Do you mean into asp.net form tag?
>>* You'll loose so features like recursive field lookup, default field values and other things you can specify on <umbraco:Item
Why? I read that Umbraco Razor supports every Umbraco Lib functions like XSLT.
>>* This is a theory and not a practice, I don't recommend you do it :P
?
I think what Slace was trying to say is that Razor was designed as an ASP.NET viewengine, not as a classic webforms server side control (basically anything that has a runat="server" attribute).
Yes, it does support all of the XSLT extensions. Also, with the .AncestorOfSelf method you can do recursive lookup just fine.
I wouldn't know why you should not do it, if you don't need server side controls then go for it.
is working on a reply...