Copied to clipboard

Flag this post as spam?

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


  • Andrew Rebane 14 posts 35 karma points
    Apr 27, 2015 @ 17:05
    Andrew Rebane
    0

    RenderTemplate by name

    there is Umbraco.RenderTemplate ( contentId, templateId ) 

    how can I do Umbraco.RenderTemplate ( contentId, templateName ) ?

  • Andrew Rebane 14 posts 35 karma points
    Apr 27, 2015 @ 17:08
    Andrew Rebane
    0

    sorry, alias

  • Andrew Rebane 14 posts 35 karma points
    Apr 27, 2015 @ 17:13
    Andrew Rebane
    0

    I found 

    umbraco.cms.businesslogic.template.Template.GetByAlias("aliasName").Id; 

    this the best practice for such a common task?

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Apr 27, 2015 @ 17:38
    Dennis Aaen
    0

    Hi Andrew,

    If you are using Umbraco 6.x or newer I think it would be a better idea to use the different serices to get content media, members and so on. And there is also the FileService where you have the method .GetTemplate(string alias) Gets a single ITemplateObject object.

    As far as I know the umbraco.cms.businesslogic is the old way of doing it, but I am not a .NET developer.

    Hope this helps.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft