Copied to clipboard

Flag this post as spam?

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


  • chris 69 posts 92 karma points
    Jul 06, 2011 @ 18:49
    chris
    0

    How do I use tags?

    I have Umbraco 4.0.4.2. I'm trying to use the tags datatype, using the basic xslt from the site map.

    The site has this structure:

    -Articles

    -Article 1    ;has a tag "Arts"

    -Article 2    ;has a tag "Science"

     

    -Categories

    -Arts         ;clicking here will list all articles that has "Arts" tag

    -Science    ;clicking here will list all articles that has "Science" tag

     

    So I'd insert a macro under Categories\Arts and it will search everything under Articles and list the ones that has 'arts' tag.

    <xsl:param name="currentPage"/>
    <xsl:template match="/">
    <ul>
    <xsl:apply-templates select="$currentPage/node" />
    </ul>
    </xsl:template>
    <xsl:template match="node">
    <li>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName" />
    </a>
    </li>
    </xsl:template>
    <xsl:template match="node[data[@alias = 'umbracoNaviHide'] = 1]" />

     

     

    How do I get the xslt to point to the Articles node and start grabbing all articles, and sort it out by the specified tags?

  • chris 69 posts 92 karma points
    Jul 06, 2011 @ 20:37
    chris
    0

    Nevermind this, I figured it out by using this:

      <xsl:param name="ArticleNode" select="umbraco.library:GetXmlNodeById(1000)" />
      <xsl:param name="dTags" select="/macro/pTags" />
       
      <xsl:template match="/">
        <ul>
          <xsl:for-each select="$ArticleNode/node [string(data [@alias = 'umbracoNaviHide']) != '1' and contains(data[@alias='pageTags'], $dTags)]">
            <xsl:sort select="@updateDate" order="descending"/>
            <li>
              <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:value-of select="@nodeName"/>
              </a>
            </li>
          </xsl:for-each>
        </ul>
      </xsl:template>
Please Sign in or register to post replies

Write your reply to:

Draft