Copied to clipboard

Flag this post as spam?

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


  • Brian Wilkinson 10 posts 90 karma points
    Jan 13, 2017 @ 21:55
    Brian Wilkinson
    0

    News ticker sharing content across all site pages.

    I have a news ticker in my site master template, what I want is the content editors to be able to edit the content of the news ticker without risking breaking the master template. I have thought about including a property as a composition in the content template but this would mean that the content editors would need to enter the news ticker on every page. Is there a way to link a newsticker content page into the master template, so that the content editors only have to edit the content in the page to effect every page within the site.

  • Nik 1616 posts 7262 karma points MVP 7x c-trib
    Jan 13, 2017 @ 23:43
    Nik
    0

    Hi Brian,

    Would you be able to explain a bit more please, I'm not 100% sure I understand what you are asking for.

    Currently, my understanding is that in your master template (cshtml file?) you are trying to render out a news ticker so that it shows on all pages. However, you believe that you currently have to configure this on the template for all other document types so it will render?

    If that is correct, you could just have the news ticker on your Home Page document type (assuming under the content section you create a Home Page as your first node and everything else sits underneath it), you could then use something like this in your template to get the content for your ticker:

    var tickerContent = Model.Content.Site.GetPropertyValue("myTickerProperty");
    

    This would, in your master template, allow you on any page to get the highest level node and retrieve a property off of it.

    It works on the assumption that under the Content section your tree looks something like this:

    Example tree structure

  • Brian Wilkinson 10 posts 90 karma points
    Jan 14, 2017 @ 12:14
    Brian Wilkinson
    0

    Hi thanks for the reply, with your pointer I've now managed to get what I want, I've now got the news ticker content as a property in the home page.

  • Nik 1616 posts 7262 karma points MVP 7x c-trib
    Jan 14, 2017 @ 12:23
    Nik
    100

    No problem at all Brian, that's what this community is all about :-) Pleased you got it working.

    It would be great if you could flag the appropriate response as the solution to your issue so that if others come along with a similar issue they can see what helped you :-)

Please Sign in or register to post replies

Write your reply to:

Draft