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 some previous and next buttons, but when I try to add some conditionals to them the script does't load anymore. I also would like to have it check for previous and next siblings, in case one of them is not visible (umbracoNaviHide).
Here is my inline macro from the template:
<umbraco:Macro runat="server" language="cshtml"> <div class="prevNextWrap"> @{ if (@Model.Previous().Where("Visible && NodeTypeAlias == \"TwoColumnAdmissionsLeftNav\" || NodeTypeAlias == \"OneColumnAdmissions\"")){ <a class="prevNext" href="@Model.Previous().Url">Previous</a> } if (@Model.Next().Where("Visible && NodeTypeAlias == \"TwoColumnAdmissionsLeftNav\" || NodeTypeAlias == \"OneColumnAdmissions\"")){ <a class="prevNext" href="@Model.Next().Url">Next</a> } } </div> </umbraco:Macro>
Hi Steve,
To check there is a next and previous node you could use
@Model.Next() != null @Model.Previous() != null
Could you try the code snippet below and see if it solve your issue.
<umbraco:Macro runat="server" language="cshtml"> <div class="prevNextWrap"> @{ if (@Model.Previous().Where("Visible && NodeTypeAlias == \"TwoColumnAdmissionsLeftNav\" || NodeTypeAlias == \"OneColumnAdmissions\"")){ @if(Model.Previous() != null){ <a class="prevNext" href="@Model.Previous().Url">Previous</a> } } if (@Model.Next().Where("Visible && NodeTypeAlias == \"TwoColumnAdmissionsLeftNav\" || NodeTypeAlias == \"OneColumnAdmissions\"")){ @if(Model.Next() != null){ <<a class="prevNext" href="@Model.Next().Url">Next</a> } } } </div> </umbraco:Macro>
Hope this helps,
/Dennis
Sorry Dennis, but this doesn't load. I'll keep trying different syntax.
EDIT: It seems that the error happens when the navigation gets to the first or ending node in the group.
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
Previous and Next Button Navigation
I have some previous and next buttons, but when I try to add some conditionals to them the script does't load anymore. I also would like to have it check for previous and next siblings, in case one of them is not visible (umbracoNaviHide).
Here is my inline macro from the template:
Hi Steve,
To check there is a next and previous node you could use
Could you try the code snippet below and see if it solve your issue.
Hope this helps,
/Dennis
Sorry Dennis, but this doesn't load. I'll keep trying different syntax.
EDIT: It seems that the error happens when the navigation gets to the first or ending node in the group.
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.