Copied to clipboard

Flag this post as spam?

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


  • Roger Withnell 128 posts 613 karma points
    May 26, 2015 @ 15:01
    Roger Withnell
    0

    Create a banner on every page with GridLayout

    My "master" template code is:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    @{

        Layout = null;

    var SiteItems = CurrentPage.Site();

    }

    <html>

    <head>

    <title>

    @Umbraco.Field("pageName")

    </title>

    <link rel="stylesheet" href="/css/bootstrap.min.css">

    <link rel="stylesheet" href="/css/style.css">

    </head>

    <body>

    <div style="height:8px"></div>

    @CurrentPage.GetGridHtml("SiteHeaderRow")

    @RenderBody()

    </body>

    </html>

    The "SiteHeaderRow" property is in a document type that is use for the home page.

    The home page displays the "SiteHeaderRow" but other pages, that use a different document type, do not display the "SiteHeaderRow".

    How should I configure the document types and templates to resolve this?

    Your help would be much appreciated.

    Thanking you in anticipation.

    Roger

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    May 26, 2015 @ 15:10
    Dennis Aaen
    100

    Hi Roger,

    One of the downsides with the grid layout editor is that there are some limitations. One of the limitations is to reuse content from on page to another. A grid layout is not a recommended storage of reusable content - it simply wasn't designed for this scenario. If you wish to reuse content in multiple pages, it is still recommended that you store these pieces of content as separate content nodes, so they can be stored, cached and queried as usual.

    https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/built-in-property-editors-v7/Grid-Layout/Grid-Layout-Best-Practices#Limitations

    So I would recommend you to do the banner thing the old way with a media picker editor, else you would need to at the same banner on every page.

    Hope this helps,

    /Dennis

  • Roger Withnell 128 posts 613 karma points
    May 26, 2015 @ 17:03
    Roger Withnell
    0

    Thanks for this, Dennis.

    But how do I "store these pieces of content as separate content nodes, so they can be stored, cached and queried as usual"?  I'm struggling getting content to display in every document; it will only display in the document to which the document type containing the property is assigned.

    Roger 

  • Roger Withnell 128 posts 613 karma points
    May 26, 2015 @ 17:46
    Roger Withnell
    0

    Got it!  Use recursive:

    @Umbraco.Field("hr_header", recursive:true)

    Many thanks for your help, Dennis.

    Roger

     

Please Sign in or register to post replies

Write your reply to:

Draft