locked
Display file type icon in Content Query Webpart RRS feed

  • Question

  • I was able to add a style to the item-styles.

    And change the font color, family etc.

     

    Now I would like to display the file type Icon in the Content Query Webpart, so it shows what type of document it is, word excel etc.

     

    if I look at a standard style, for example image on the right. it uses a function to read out the Image URL I think is stored in a clomun linked with the title url.

    Does anyone how to acces (or find) the file type icon? Or the field id for the file type icon

     

     <xsl:variable name="SafeImageUrl">
                <xsl:call-template name="OuterTemplate.GetSafeStaticUrl (??) "> 
                    <xsl:with-param name="UrlColumnName" select="'ImageUrl (??) '"/>
                </xsl:call-template>
            </xsl:variable>

     

    Thanks.

     

    Wednesday, May 2, 2007 1:44 PM

Answers

  • Oke, worked it out

     

    First I made the Icon available in the webpart.

    Export the webpart and open the file with notepad and add:

            <property name="CommonViewFields" type="string">File_x0020_Type, Text</property>

      Then in the ItemStyle.xsl file I added (in the div section of my Template):

                <div class="image-area-left">
                   <a href="{$SafeLinkUrl}" target="{$LinkTarget}">
                      <img class="image" src="/_layouts/images/ic{@File_x005F_x0020_Type}.gif" alt="{@ImageUrlAltText}" />
                    </a>
                  </div>

    This gave me I nice out-of-the-box icon before every item.

     

    Tuesday, May 8, 2007 3:05 PM

All replies

  • Oke, worked it out

     

    First I made the Icon available in the webpart.

    Export the webpart and open the file with notepad and add:

            <property name="CommonViewFields" type="string">File_x0020_Type, Text</property>

      Then in the ItemStyle.xsl file I added (in the div section of my Template):

                <div class="image-area-left">
                   <a href="{$SafeLinkUrl}" target="{$LinkTarget}">
                      <img class="image" src="/_layouts/images/ic{@File_x005F_x0020_Type}.gif" alt="{@ImageUrlAltText}" />
                    </a>
                  </div>

    This gave me I nice out-of-the-box icon before every item.

     

    Tuesday, May 8, 2007 3:05 PM
  • In the ItemStyle.xsl file where did you add the following code:

    <div class="image-area-left">
                   <a href="{$SafeLinkUrl}" target="{$LinkTarget}">
                      <img class="image" src="/_layouts/images/ic{@File_x005F_x0020_Type}.gif" alt="{@ImageUrlAltText}" />
                    </a>
                  </div>

    Thanks!

    Monday, June 29, 2009 8:40 PM