Copied to clipboard

Flag this post as spam?

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


  • Frederik T 241 posts 372 karma points
    Aug 12, 2011 @ 12:34
    Frederik T
    0

    A list of all documents inherting from parent document type

    Hope my topic makes a bit of sense.

    Ok, the thing is, the site im working on as several sub sections, and those have sub sections as well.

    -Main
    ---section1
    ......section1,1
    ......section1,2
    ---section2
    ......section2,1
    ---section3

    Sorta like that. Each sub-sub section (like section1,2) has several articles/documents in them. Each section has their own unique document type, but they inherit from the same parent document.

    In for example section 1, i have to make a list of all the newest articles in each sub section (section 1,1/1,2 etc.)

    Now starts the hairy part, this is what ive come up with as of now:

    <xsl:variable name="documentTypeAlias1" select="string('documentType1')"/>
    <xsl:variable name="documentTypeAlias2" select="string('documentType2')"/>
    <xsl:variable name="documentTypeAlias3" select="string('documentType3')"/>

    <xsl:template match="/">

    <
    ul>
    <xsl:for-each select="$currentPage/descendant::* [name() = $documentTypeAlias1 or name() = $documentTypeAlias2 and string(umbracoNaviHide) != '1']">
      <xsl:sort select="@updateDate" order="descending" />
      <li>
        <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>
          
          <xsl:if test="count(current()/outputPictures) > 0">
            <img src="/ImageGen.ashx?image={current()/outputPictures[position()=1]/DAMP[@fullMedia]/mediaItem/Image/umbracoFile}&amp;width=125&amp;height=70" width="125" height="70"/>
          </xsl:if>
          
        </a>
      </li>
    </xsl:for-each>
    </ul>

    (the variable names are example names for the sake of this post, company policy you know)

    This creates a list of the specified document types, orders them, then shows the first picture in its gallery as a thumbnail.

    It works, somewhat, because first of all, its outright stupid doing it the way i am, storing document types in variables and stuffing them into the select, also it orders them by the document type, and not the speciefic documents updateDate. But i dont know of any other way.

    Therefor, i thought it would be possible to just make it list ALL document types under that section and sub sections, inheriting from the parent document type. But i dont know how to.

    I hope it makes sense, and maybe there is an entirely other method.

  • Frederik T 241 posts 372 karma points
    Aug 12, 2011 @ 12:41
    Frederik T
    0
    It works, somewhat, because first of all, its outright stupid doing it 
    the way i am, storing document types in variables and stuffing them into
     the select, also it orders them by the document type, and not the 
    speciefic documents updateDate. But i dont know of any other way.

    Ok it wont let me edit my post so here is fixed version of this paragraph:

    It works, somewhat, because first of all, its outright stupid doing it 
    the way i am, storing document types in variables and stuffing them into
     the select, also it orders them by the document type (as in, it 
    displays the newest document type and its related articles, to the 
    oldest, if you understand), and not the 
    speciefic documents updateDate. But i dont know of any other way.

    I really hope someone can help me with this, and sadly i cant change the topic of my original post after double-posting, as its somewhat misleading.

     

Please Sign in or register to post replies

Write your reply to:

Draft