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?
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.
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?
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.
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:
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.
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?
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.
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.
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?
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.
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]">
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.
Ok, thanks for your help.
is working on a reply...