Copied to clipboard

Flag this post as spam?

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


  • Jonathan Roberts 372 posts 1005 karma points
    Nov 04, 2016 @ 10:05
    Jonathan Roberts
    0

    Convert Umbraco ContentXML and render as a html pagr

    Hi,

    Is it possible to get the XML from either the ContentXML table or the PreviewXML table and generate a HTML webpage so I can use to compare versions?

    Thanks

    Jon

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Nov 07, 2016 @ 10:56
    Alex Skrypnyk
    0

    Hi Jonathan,

    Usually developers don't need to do pages in such way.

    IPublishedContent - interface for working with xml cached content.

    Why did you decide to use sql tables? And show us your code if it's possible.

    Thanks,

    Alex

  • Jonathan Roberts 372 posts 1005 karma points
    Nov 07, 2016 @ 11:02
    Jonathan Roberts
    0

    My apologies, Its not really data direct from the SQL tables. I basically would like to create a way to neatly show the actual pages of two versions of the same page.

    I know the Role back feature has a way to do a Compare but for the average user this method is quite unfriendly. I would like to convert the JSON that Content has when querying a version into a HTML page so the user can visually see the page as opposed to the source.

    I hope that makes sense,

    Jon

  • Booker Ulrick 1 post 71 karma points
    Aug 03, 2017 @ 12:54
    Booker Ulrick
    0

    Blockquote Hi Jonathan,

    Usually developers don't need to do pages in such way.

    IPublishedContent - interface for working with xml cached content.

    Why did you decide to use sql tables? And show us your worldwide brands membership of http://www.ilfairmap.com if it's possible.

    Thanks,

    I also want to convert the JSON that Content has when querying a version into a HTML page so the user can visually see the page as opposed to the source.I think there isn't any problem.

  • Chris Perks 32 posts 114 karma points
    Nov 07, 2016 @ 11:06
    Chris Perks
    0

    Hi,

    Try the GetByVersion() method of ContentService - as detailed below:

    https://our.umbraco.org/documentation/reference/management/services/contentservice

    This should allow you to get one or more versions of the same content item, then compare properties.

  • Jonathan Roberts 372 posts 1005 karma points
    Nov 07, 2016 @ 11:08
    Jonathan Roberts
    0

    But does this give you the HTML of the page?

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Nov 07, 2016 @ 11:13
    Alex Skrypnyk
    0

    Hi Jonathan, you can render page and get html.

    var htmlOfPage = Umbraco.RenderTemplate(pageId);
    

    Thanks,

    Alex

  • Jonathan Roberts 372 posts 1005 karma points
    Nov 07, 2016 @ 11:16
    Jonathan Roberts
    0

    Dont all versions have the same pageId?

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Nov 07, 2016 @ 11:25
    Alex Skrypnyk
    0

    Jonathan, all versions have the same id

  • Jonathan Roberts 372 posts 1005 karma points
    Nov 07, 2016 @ 11:32
    Jonathan Roberts
    0

    How would i get the HTML for a specific version?

  • Jonathan Roberts 372 posts 1005 karma points
    Nov 07, 2016 @ 13:32
    Jonathan Roberts
    0

    Hi, is it possible to do this but with the GUID of the version?

  • Chris Perks 32 posts 114 karma points
    Nov 07, 2016 @ 11:13
    Chris Perks
    0

    ContentService just gives you access to the versioned content - are you using MVC to render the content? If so, the usual MVC rendering methods (for views and partial views) can render whatever you pass to it.

  • Jonathan Roberts 372 posts 1005 karma points
    Nov 07, 2016 @ 11:16
    Jonathan Roberts
    0

    So, can you create the page from a version GUID? Do you have an example?

  • Jonathan Roberts 372 posts 1005 karma points
    Jun 23, 2017 @ 08:53
    Jonathan Roberts
    0

    Is this possible?

  • 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.

Please Sign in or register to post replies