Copied to clipboard

Flag this post as spam?

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


  • Bartosz 1 post 21 karma points
    Mar 12, 2012 @ 14:24
    Bartosz
    0

    Automated link button

    I am developing a simple app in Umbraco CMS. The thing I want to achieve is built an automated link which will appear on every single level 2 element and will lead to its parent element on level 1. Example:

    • item 1
      • subItem a
      • subItem b
      • subItem c
    • item 2
      • subItem d
      • subItem e

    The link from pages a,b and c should target item 1, while d and e link should lead to item 2.

    I assume I should use some macro XSLT code to link my element with its parent object in level 1 menu structure, but I do not know how to do it.

    Any ideas?

    Thanks,

    Bartosh

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Mar 12, 2012 @ 23:38
    Jan Skovgaard
    0

    Hi Bartosh and welcome to the community! :)

    You should be able to fetch the node id from the parent by using the :parent axis.

    Something like this should do the trick (from the top of my head).

    <xsl:value-of select="umbraco.library:NiceUrl($currentPage/parent::*[@isDoc]/@id)" />

    Hope this helps.

    /Jan

  • 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