Copied to clipboard

Flag this post as spam?

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


  • Kate 267 posts 610 karma points
    Feb 05, 2014 @ 11:58
    Kate
    0

    Content on more than one page

    Hi

    How do I change this bit of code so I can grab it from diffrent templates?

    @if(Model.HasValue("_overskriftCol1")){
    <div class="cntEmployeeBlack">
    <div class="employeeBlack Center-Light">
    <div class="col col1">
    <h2 class="Center-Medium">@Model._overskriftCol1</h2>
    <div>
    @Model._tekstCol1
    </div>
    </div>
    <div class="col col2">
    <h2 class="Center-Medium">
    @if(Model.HasValue("_overskriftCol2")){
    @Model._overskriftCol2
    }
    &nbsp;
    </h2>
    <div>
    @Model._tekstCol2
    </div>
    </div>
    </div>
    </div>
    }

    /Kate

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 06, 2014 @ 13:37
    Dennis Aaen
    100

    Hi Kate,

    So if I understand your right you want to display some information form a node on other places on your website.

    Then you could use:

    var content = Library.NodeById(id of the node where you want the data from);

    <p>@content.propertyAlias</p>

    Or if you donĀ“t want to hardcode the id, you could do it by document type alias like this:

    var root = Model.AncestorOrSelf(); 

    var content= root.Descendants("Name on your documenttype").First();

    <p>@content.propertyAlias</p>

     

    /Dennis

  • Kate 267 posts 610 karma points
    Feb 06, 2014 @ 13:48
    Kate
    0

    Hi Dennis

    Thanks

    Just what i need :-)

     

    /Kate

Please Sign in or register to post replies

Write your reply to:

Draft