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
    Oct 10, 2013 @ 16:12
    Kate
    0

    find a doctype

    I have a doc type "textpage" which is used at different levels on the site.
    Depending on what level the doc type is used, the output will be
    slightly diffrent
    So what I want is that when doctypen "textpage" is used below a doctype called "Destination" then the "textpage" will be showed with an extra image/icon otherwise it will be displayed without the images/icon.

    So I was thinkin somthinge like this:

    If (page= Destination/textpage)
         Then show images
    elseif (page= textpage)
         dont show images

    I just don't have any idea on how to code it in Razor :-)

    Kan anyone help

    /Kate 


  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Oct 10, 2013 @ 18:08
    Dennis Aaen
    100

    Hi Kate,

    I have just made a small test on one of my dev sites. If I understand you correct the destination documenttype is always a parent for an text page. If so I thik you should be able to do something like this:

    @{
     
    if(Model.Parent.NodeTypeAlias=="
    Destination"){
     
    <img src=""/>
       
    }elseif(Model.NodeTypeAlias=="
    Textpage"){
       
     
    }
    }

    I hope this do what you was looking for Kate.

    /Dennis

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Oct 14, 2013 @ 08:16
    Dennis Aaen
    0

    Hi Kate,

    Did you managed to find a solution to your question, and could you use my suggestion?

    /Dennis

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 14, 2013 @ 08:55
    Fuji Kusaka
    0

    How about making use of @level here ? So depending on whatever level this docType is being used it renders something different.

    if (CurrentModel.Level == 2 && CurrentModel.NodeTypeAlias == "Destination"){
    //
    }
  • Kate 267 posts 610 karma points
    Oct 14, 2013 @ 13:23
    Kate
    0

    Hi Dennis

    I haven't had the time to look at it yet, but hope that I can this afternoon or tomorrow.
    I will return when I have had a look at it :-)

  • Kate 267 posts 610 karma points
    Oct 15, 2013 @ 17:43
    Kate
    0

    Hi Dennis and Fuji

    Thanks for  your suggestions.
    They
    both worked fine, just what I needed :-)
    Thanks again for your help

    /Kate

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Oct 15, 2013 @ 17:47
    Dennis Aaen
    0

    Hi Kate,

    That´s brilliant news. I glad that I could help you find a solution.

    /Dennis

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies