Copied to clipboard

Flag this post as spam?

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


  • Jules 276 posts 587 karma points
    Nov 19, 2012 @ 11:34
    Jules
    0

    Virtual Nodes and sharing content

    Hi all

    Am using U4.9 currently and will be upgrading this install to 4.10.1 shortly.

    I am creating an Umbraco install that will have multiple websites and content that will need to be shared across these sites.

    Umbraco will have this content structure

    Content
        Site1Home
            News
            Item1
        Site2Home
            News
            Item1
            Item2
        Site3Home
            News
            Item1
            Item2
            Item3
        Shared Content
            News
                Item1
                Item2
                Item3

    I want to create a news section in a SharedContent node that is outside each of the 3 website nodes.  When entering a news article in the News section, the user will choose which of the websites this article will appear on by ticking a checkbox (ShowOnSite1, ShowOnSite2 etc).

    Now the tricky bit.  When a news article in the SharedContent area is published, I want to render virtual nodes under each News Node in each of the websites.

    I assume there are a few events that I could hook into... could anyone point me in the right direction? Has anyone done this before?

    Jules

  • Marcos 9 posts 30 karma points
    Nov 19, 2012 @ 13:51
    Marcos
    0

    You could add just a simple macro that filters nodes of Shared Content based on the alias of the current site:

    1) Get the alias of current site

    2) Get the nodes of Shared Content

    3) Loop into the shared content based on the document type you want to publish and the current website alias

     

    Hope it's clear ;)

  • Jules 276 posts 587 karma points
    Nov 19, 2012 @ 14:11
    Jules
    0

    Hi Marcos

    Thanks for the reply.

    Unless I am missing the point, this doesn't seem to address the creation of a virtual node.  Obviously there would be code that would be filtering the news items according to website name/alias - that is not the problem though.  How woudl a news item appear on its own page in the website?

    The above idea for a macro could output a list of newsitems and could filter for each website but I need each news item to have its own webpage. 

    What I am trying to do is render shared content on its own page but without having to create that page in the content tree - hence the term virtual node - this would be a node that is created after a user clicks publish  and would be injected into the cache (umbraco.config) but would never actually exist in the content tree (only in the SharedContent) section.

    It must be possible - I know I need to hook into some events to do this but am not completely sure where to start.

    Jules

     

     

  • Marcos 9 posts 30 karma points
    Nov 19, 2012 @ 14:18
    Marcos
    0

    Ok, got the point now. Yes you're right. You need to hook into an event. umbraco.cms.businesslogic.web.Document class contains all the events for a document (including saving and publishing ones).

    This way, you could duplicate the current document and save it in the right website.

Please Sign in or register to post replies

Write your reply to:

Draft