Copied to clipboard

Flag this post as spam?

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


  • Damien Green 72 posts 134 karma points
    Aug 10, 2014 @ 00:25
    Damien Green
    0

    Looping through pages and outputting the template html

    Hi Guys,

    I'm in the process creating a single page website that contains multiple pages rendered as one continuous page. I have a series of sub pages that I am intending to loop through and render the html content created by that page's template out.

    My question is, is there a way to render out the content of the page's html? I can obviously do this in Javascipt but for this purpose I'd much rather have a server side implementation. I could of course add a couple of properties to my pages and then render the contents of those out, but I'd rather grab the page and actually render out the html that has been defined by its template which would allow me to define the page's style in the template.

    Hope this makes sense,

    Thanks,

  • Damien Green 72 posts 134 karma points
    Aug 10, 2014 @ 00:43
    Damien Green
    0

    I've just found the answer,

    @Html.Raw(umbraco.library.RenderTemplate(Page.Id));

    is what you need. I thought I'd post this just in case anyone else wants to know.

    Cheers,

    Damien.

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Aug 10, 2014 @ 13:10
    Jeavon Leopold
    0

    Hi Damien,

    Yes, except that umbraco.library.RenderTemplate(Page.Id) has been superseded by Umbraco.RenderTemplate(Page.Id)

    Jeavon

  • Damien Green 72 posts 134 karma points
    Aug 10, 2014 @ 23:50
    Damien Green
    0

    Jeavon,

    Thank you so much for the additional info - I've updated my code accordingly. It's very easy to find outdated info for Umbraco but I'll definitely be studying the need library closely.

    Thanks again,

    Damien

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Aug 11, 2014 @ 13:42
    Jeavon Leopold
    0

    No problem. You can find most of the UmbracoHelper methods documented here

Please Sign in or register to post replies

Write your reply to:

Draft