Last active
May 29, 2024 13:04
-
-
Save kitzberger/9fb926246d2c2502eb4f90f946bc9f36 to your computer and use it in GitHub Desktop.
TYPO3: clever HMENU browse next/prev
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This menu is considered to be 'clever' due to the fact that it's sliding accross the entire page tree: | |
# | |
# * Previous link: if there's no previous sibling page, we're linking to the parent page instead | |
# * Next link: | |
# * if there's no child page, we're linking to the next sibling page | |
# * if that's not available, we're linking to the next sibling page of the parent page | |
# * if that's not available, we're linking to the next sibling page of the grandparent page | |
temp.browseMenuItem = HMENU | |
temp.browseMenuItem.special = browse | |
temp.browseMenuItem.includeNotInMenu = 0 | |
temp.browseMenuItem.1 = TMENU | |
temp.browseMenuItem.1.NO = 1 | |
page.10.variables { | |
# Menu item for prev-link | |
prevPage < temp.browseMenuItem | |
prevPage { | |
# Try prev sibling first | |
special.items = prev | |
# If not available -> use parent page instead | |
stdWrap.ifEmpty.override.cObject < temp.browseMenuItem | |
stdWrap.ifEmpty.override.cObject { | |
special.items = up | |
} | |
} | |
# Menu item for next-link | |
nextPage < temp.browseMenuItem | |
nextPage { | |
# Try first child first | |
special = directory | |
maxItems = 1 | |
# If not available -> use next sibling | |
stdWrap.ifEmpty.override.cObject < temp.browseMenuItem | |
stdWrap.ifEmpty.override.cObject { | |
special.items = next | |
# If not available -> use parent's sibling | |
stdWrap.ifEmpty.override.cObject < temp.browseMenuItem | |
stdWrap.ifEmpty.override.cObject { | |
special.items = next | |
special.value.data = leveluid:-2 | |
# If not available -> use grandparent's sibling | |
stdWrap.ifEmpty.override.cObject < temp.browseMenuItem | |
stdWrap.ifEmpty.override.cObject { | |
special.items = next | |
special.value.data = leveluid:-3 | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment