Copied to clipboard

Flag this post as spam?

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


  • Mikael Mørup 297 posts 326 karma points
    Aug 07, 2009 @ 15:17
    Mikael Mørup
    0

    Preview and nodeFactory

    When trying to preview pages that use macros that in turn use the nodeFactory, i get an error stating that it is not possible to preview unpublished nodes that uses the nodeFactory.

    Is there anyway around this problem ?

    Do i have to rewrite my usercontrols to handle nodes in another way ?

    i'm aware that the nodeFactory only works with published nodes, but it's a major problem for my client if they can't preview pages without publishing them.

    Mikael

     

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Aug 07, 2009 @ 15:28
    Aaron Powell
    100

    Long story short, preview simply doesn't work in Umbraco. Because the preview runs through the standard Umbraco rendering engine, which in turn goes through nodeFactory.

    If you want to access unpublished Umbraco content you need to go through the Document API (the cms assembly).

    There isn't any intention in the core team to fix the preview in the 4.x branch, it's too complex a problem to try and solve. If someone else solves it we'd LOVE to have it submitted!

  • Mikael Mørup 297 posts 326 karma points
    Aug 07, 2009 @ 17:17
    Mikael Mørup
    0

    Thanks.

    That unfortunately means that i have to reprogram a bunch of usercontrols  :-(

    Well well welll, another experience richer i will go home and have a nice weekend.

    I wish the same to everyone else.

     

    Mikael

  • anthony hall 222 posts 536 karma points
    Aug 07, 2009 @ 19:46
    anthony hall
    0

    perhaps you could create a field 'preview page ' true / false and then use an after publish event to move it to content type that is not publically visable

    mydomain/.com/preview

     

        public class AfterPublishEvent : umbraco.BusinessLogic.ApplicationBase
        {
            public AfterPublishEvent()
            {
                Document.AfterPublish += new Document.PublishEventHandler(Document_AfterPublish);
            }
            static void Document_AfterPublish(Document sender, PublishEventArgs e)
            {
                sender.Move(newParentId);
            }
        }

     

     

     

  • Shaun 248 posts 475 karma points
    Mar 09, 2010 @ 16:20
    Shaun
    0

    Hi 

    I too have a problem displaying previews of unpublished content using the nodeFactory (In this instance, the otherwise brilliant BlogforUmbraco4).

    I don't intend to do a big rewrite to fix it, as from what I can see this is a core issue in Umbraco.

    instead I want to just "hide" the preview button for blog content. How do I go about doing that?

    Many thanks

    Shaun

     

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Mar 10, 2010 @ 09:50
    Aaron Powell
    0

    Hmm this is a great example of when I wish i could edit posts :P.
    There's been quite a bit of work done recently to get preview working for 4.1. I'm not 100% sure what the status is, I think some early stuff made it into the beta 2 release.

Please Sign in or register to post replies

Write your reply to:

Draft