November 04, 2009

Search for Folders[To Bring folder icon instead of default IE]

If no extension, search will give default IE Icon.
Just find this code in the XSL for the core result webpart:

Code Block
<!-- This template is called for each result -->
<xsl:template match="Result">
<xsl:variable name="id" select="id"/>
<xsl:variable name="url" select="url"/>
<span class="srch-Icon">
<a href="{$url}" id="{concat('CSR_IMG_',$id)}" title="{$url}">
<img align="absmiddle" src="{imageurl}" border="0" alt="{imageurl/@imageurldescription}" />
</a>
</span>

Add
Code Block
<xsl:variable name="isdoc" select="isdocument"/>

After
Code Block

<xsl:variable name="id" select="id"/>
<xsl:variable name="url" select="url"/>

and replace
Code Block
<img align="absmiddle" src="{imageurl}" border="0" alt="{imageurl/@imageurldescription}" />

by
Code Block

<xsl:if test="$isdoc = 0">
<img align="absmiddle" src="/_layouts/images/folder.gif" border="0" alt="{imageurl/@imageurldescription}" />
</xsl:if>
<xsl:if test="$isdoc = 1">
<img align="absmiddle" src="{imageurl}" border="0" alt="{imageurl/@imageurldescription}" />
</xsl:if>

It is not as clean as I would because I hard-coded the src path.
I did not find out where the {imageurl} variable is extracted (if someone could help).

No comments:

SonarQube with Jenkins Setup using Docker Images

https://funnelgarden.com/sonarqube-jenkins-docker/  https://medium.com/@hakdogan/an-end-to-end-tutorial-to-continuous-integration-and-con...