Copied to clipboard

Flag this post as spam?

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


  • Collin 42 posts 62 karma points
    Aug 04, 2011 @ 13:15
    Collin
    0

    Programmatically calling preview mode

    For one of our sites we have offered dashboard like functionality where you can edit information that has been stored in the umbraco site.

    To further enhance this dashboard we want to add preview capabilities for the content being displayed. How do I trigger the preview mode programmatically from the user control so that the requested content is visible?

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Aug 05, 2011 @ 16:42
    Dan Diplo
    0

    You can just create a link to /umbraco/dialogs/preview.aspx?id=1234 where the id is the id of the page node you want to preview.

  • Collin 42 posts 62 karma points
    Aug 09, 2011 @ 08:56
    Collin
    0

    I tried that before I posted the comment but that didn't work. It gave a not found error message, it would only work if I had triggered the preview mode before I generated the link. And that was a manual action by me that I couldn't do in code.

    Although I will try the suggestion you made.

  • Collin 42 posts 62 karma points
    Aug 15, 2011 @ 11:05
    Collin
    0

    Creating a link to /umbraco/dialogs/preview.aspx?id=1234 indeed works correctly and triggers the preview mode.

    However I noticed a slight issue while using this. There is a XSLT macro on the page that pulls in information of children documents. But in preview mode these unpublished children documents are not shown.

    As far as I understood the preview mode of umbraco these should be automatically be picked up by the umbraco preview mode. As they are children of the document I put in preview mode.

    Does anyone have suggestions on how I can also show these children in preview mode?

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Aug 15, 2011 @ 12:20
    Dan Diplo
    0

    As far as I know (and I'm not an Umbraco developer) the preview mode is intended to show how your page would look when published. If you actually published a page that pulls in content from unpublished pages then the content from those unpublished pages would not be displayed either. So, in this respect, the preview works as I would expect.

    You might want to check out the CogWorks Super Preview project which, I believe, can be made to work like you wish.

  • Collin 42 posts 62 karma points
    Aug 15, 2011 @ 13:38
    Collin
    0

    Hmm, I'm not entirely sure if I want to add a package to umbraco for just one page.

    It isn't possible to fetch all the results, published or not, in the XSLT? Which would mean I need to change something in the following code, but I have no idea how:

    <xsl:for-each select="$currentPage/*/* [@isDoc]">

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Aug 15, 2011 @ 15:01
    Dan Diplo
    0

    I'm not an expert or a dev, so can't say conclusively, but I don't think so. The problem is XSLT macros work against the XML in the Umbraco.config file (in /App_Data/) which only consists of published content.

  • Collin 42 posts 62 karma points
    Aug 16, 2011 @ 09:24
    Collin
    0

    Ok, thanks for your help.

Please Sign in or register to post replies

Write your reply to:

Draft