簡體   English   中英

Sharepoint內容查詢Web部件不連續顯示圖像

[英]Sharepoint Content Query webpart not showing image (intermittently)

在sharepoint中,我創建了一個內容查詢Web部件,該部件查詢一個列表並以3列網格格式顯示標題和ImageURL字段。

由於某些非常奇怪的原因,代碼在大多數情況下都有效,並且圖像和標題按照我的意願顯示在網格中。 但是,如果您刷新頁面幾次,則根本找不到圖像並將其插入標記中。 標題確實一直顯示。

我在XSL itemStyles.xsl中創建了自己的Item Style變量。 這是我的代碼:

 <xsl:template name="customStyle" match="Row[@Style='customStyle']" mode="itemstyle"> <xsl:variable name="SafeLinkUrl"> <xsl:call-template name="OuterTemplate.GetSafeLink"> <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="SafeImageUrl"> <xsl:call-template name="OuterTemplate.GetSafeStaticUrl"> <xsl:with-param name="UrlColumnName" select="'ImageURL'"/> </xsl:call-template> </xsl:variable> <div class="item"> <xsl:if test="string-length($SafeImageUrl) != 0"> <a href="{$SafeLinkUrl}"> <img class="image customstyle-img" src="{$SafeImageUrl}" title="{@ImageUrlAltText}" /> </a> </xsl:if> </div> </xsl:template> 

如果有人可以提出任何建議,我將不勝感激。

奧利弗

由於某些原因,開箱即用的代碼正在復制imageURL。 以下代碼對其進行了修復:

 <img class="item_customImage" > <xsl:attribute name="src"> <xsl:value-of select="substring-before(@ImageURL, ',')" /> </xsl:attribute> </img> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM