Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have something that should be simple but i cant crack the nut.
I want something to be shown, when you are at a specific node level. And thats about it. But it always fails at that check, and i have no idea why.
Also, some method of getting the previous pages url (so i dont have to use "onclick").
@{ var isMobileButton = Parameter.isMobilebutton; var startLevel = Parameter.startLevel;}@if (Model.AncestorOrSelf(startLevel)){ if (!isMobileButton) { <div class="back-btn-medium"> <a href="#" class="action icon-left-open" onClick=" history.back() "></a> </div> } else if (isMobileButton) { <div class="back-btn show-for-small-only"> <a href="#" class="action action-high icon-left-open" onClick=" history.back() "></a> </div> }}
Hi Frederik,
So you basically want to display button on a specific level ? the button is always there ?
Yeah. Its a back button, like a mobile app. From a specific level and downwards, it's always there.
So if you do something like this
var n =Model.AncestorOrSelf(1); foreach(var node in n.Descendants()) { if(node.Level==2) {<div class="back-btn-medium"> <a href="javascript:history.back()" class="action icon-left-open"></a> </div> } else { <div class="back-btn show-for-small-only"> <a href="javascript:history.back()" class="action action-high icon-left-open"></a> </div> } }
Doesnt work, you cant do stuff like "node.Level == 2". I will try and fiddle some more with it. But i think you misunderstood what i meant, or maybe i dont understand your example.
Sorry to bump this, but i still havent figured this out...
Am I over simplifying what you're asking for but surely it's just something like this (replacing the @: outputs obviously with your button or nothing:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ var startLevel = 2; if(CurrentPage.Level > startLevel) { @:Button out here } else { @: No button } }
is working on a reply...
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.
Continue discussion
Show something at specific level
I have something that should be simple but i cant crack the nut.
I want something to be shown, when you are at a specific node level. And thats about it. But it always fails at that check, and i have no idea why.
Also, some method of getting the previous pages url (so i dont have to use "onclick").
Hi Frederik,
So you basically want to display button on a specific level ? the button is always there ?
Yeah. Its a back button, like a mobile app. From a specific level and downwards, it's always there.
So if you do something like this
Doesnt work, you cant do stuff like "node.Level == 2". I will try and fiddle some more with it. But i think you misunderstood what i meant, or maybe i dont understand your example.
Sorry to bump this, but i still havent figured this out...
Am I over simplifying what you're asking for but surely it's just something like this (replacing the @: outputs obviously with your button or nothing:
is working on a reply...
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.