Copied to clipboard

Flag this post as spam?

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


  • SiKo279 82 posts 238 karma points
    Aug 20, 2009 @ 10:47
    SiKo279
    0

    Related links, recursive... trouble

    Hi,

    First off, I think Umbraco is great. Extensible, fast, etc.

    But this XSLT thing is biting me everytime I even point at it. :(

    Anyway, I want to define on the top node some Related Links, that need to appear on every page on the site.

    So, I found this post: http://our.umbraco.org/forum/developers/xslt/3331-Related-Links-Recursive

    But for some reason, it does not list the links, I added in the related links property on the top node (alias='servicesLinks')

    [code]

    <xsl:template match="/">
      <h2>Services</h2>
        <!-- The fun starts here -->
         <ul>
          <xsl:for-each select="$currentPage/ancestor-or-self::node [count(data[@alias='servicesLinks']/links/link)&gt; 0] [1] /data[@alias='servicesLinks']/links/link">
            <li>
              <xsl:element name="a">
                <xsl:if test="./@newwindow = '1'">
                  <xsl:attribute name="target">_blank</xsl:attribute>
                </xsl:if>
                <xsl:choose>
                  <xsl:when test="./@type = 'external'">
                    <xsl:attribute name="href">
                      <xsl:value-of select="./@link"/>
                    </xsl:attribute>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:attribute name="href">
                      <xsl:value-of select="umbraco.library:NiceUrl(./@link)"/>
                    </xsl:attribute>
                  </xsl:otherwise>
                </xsl:choose>
                <xsl:value-of select="./@title"/>
              </xsl:element>
            </li>
          </xsl:for-each>
        </ul>
        <!-- Live Editing support for related links. -->
        <xsl:value-of select="umbraco.library:Item($currentPage/@id,$propertyAlias,'')" />

      </xsl:template>

    [/code]

    All suggestions are welcome!

  • SiKo279 82 posts 238 karma points
    Aug 20, 2009 @ 10:47
    SiKo279
    0

    [code]<xsl:template match="/">
      <h2>Services</h2>
        <!-- The fun starts here -->
         <ul>
          <xsl:for-each select="$currentPage/ancestor-or-self::node [count(data[@alias='servicesLinks']/links/link)&gt; 0] [1] /data[@alias='servicesLinks']/links/link">
            <li>
              <xsl:element name="a">
                <xsl:if test="./@newwindow = '1'">
                  <xsl:attribute name="target">_blank</xsl:attribute>
                </xsl:if>
                <xsl:choose>
                  <xsl:when test="./@type = 'external'">
                    <xsl:attribute name="href">
                      <xsl:value-of select="./@link"/>
                    </xsl:attribute>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:attribute name="href">
                      <xsl:value-of select="umbraco.library:NiceUrl(./@link)"/>
                    </xsl:attribute>
                  </xsl:otherwise>
                </xsl:choose>
                <xsl:value-of select="./@title"/>
              </xsl:element>
            </li>
          </xsl:for-each>
        </ul>
        <!-- Live Editing support for related links. -->
        <xsl:value-of select="umbraco.library:Item($currentPage/@id,$propertyAlias,'')" />

      </xsl:template>
    [/code]

  • SiKo279 82 posts 238 karma points
    Aug 20, 2009 @ 10:47
    SiKo279
    0

    Aargh!!! We need an edit function!!!

  • SiKo279 82 posts 238 karma points
    Aug 20, 2009 @ 10:48
    SiKo279
    0

    <xsl:template match="/">
      <h2>Services</h2>
        <!-- The fun starts here -->
         <ul>
          <xsl:for-each select="$currentPage/ancestor-or-self::node [count(data[@alias='servicesLinks']/links/link)&gt; 0] [1] /data[@alias='servicesLinks']/links/link">
            <li>
              <xsl:element name="a">
                <xsl:if test="./@newwindow = '1'">
                  <xsl:attribute name="target">_blank</xsl:attribute>
                </xsl:if>
                <xsl:choose>
                  <xsl:when test="./@type = 'external'">
                    <xsl:attribute name="href">
                      <xsl:value-of select="./@link"/>
                    </xsl:attribute>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:attribute name="href">
                      <xsl:value-of select="umbraco.library:NiceUrl(./@link)"/>
                    </xsl:attribute>
                  </xsl:otherwise>
                </xsl:choose>
                <xsl:value-of select="./@title"/>
              </xsl:element>
            </li>
          </xsl:for-each>
        </ul>
        <!-- Live Editing support for related links. -->
        <xsl:value-of select="umbraco.library:Item($currentPage/@id,$propertyAlias,'')" />

      </xsl:template>

  • SiKo279 82 posts 238 karma points
    Aug 20, 2009 @ 13:13
    SiKo279
    0

    I reposted this in the developers forum/xslt.

  • Bert 128 posts 251 karma points
    Aug 20, 2009 @ 15:25
  • Bert 128 posts 251 karma points
    Aug 20, 2009 @ 15:28
    Bert
    0

    nvm wrong paste

  • SiKo279 82 posts 238 karma points
    Aug 25, 2009 @ 10:17
    SiKo279
    0

    Yeah, I copied your solution, but didn't get it to work...

  • Bert 128 posts 251 karma points
    Aug 26, 2009 @ 13:38
    Bert
    0

    Strange worked here. Got some troubles with the live editing, but just deleted that functionality

  • SiKo279 82 posts 238 karma points
    Aug 27, 2009 @ 09:01
  • 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