2011-12-29 38 views
-1

我對umbraco很新,但發現該系統非常易於使用,並且在很短的時間內完成了很多工作。我遇到的一個難題是顯示圖像。Umbraco:使用XSLT顯示圖像

在文檔類型中,我添加了一個「上傳」,其中圖像被選中。 在我的XSLT循環頁面中,此循環顯示其他字段,如描述或標題。我試圖在這裏顯示圖像。

這是我的XSLT顯示我的圖像,這什麼都沒有顯示。 「promothumbImage」字段在文檔類型中定義,正如我所說的其他所有工作都正常。

<xsl:value-of select="promothumbImage"/> 

有沒有人有任何想法,我要去哪裏錯了?

編輯:

promothumbimage被類型的文檔中定義的 「上載」

我的XSLT:

<!-- The fun starts here --> 
<div class="promoitems"> 

    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and 
string(umbracoNaviHide) != '1']"> 
    <div class="promoitem"> 

<a href="{umbraco.library:NiceUrl(@id)}"> 
    <xsl:value-of select="@nodeName"/> 
</a> 

<div class="promosmalldesc"> 
    <xsl:value-of select="promoSmallDesc"/> 
</div> 

<xsl:copy-of select="promothumbImage/*"/> 


    </div> 

</xsl:for-each> 
+0

什麼是'promothumbImage'?向我們展示您的XML文檔。 – 2011-12-29 20:38:29

+0

@Dimitre:promothumbimage在「upload」類型的文檔中定義 – Funky 2011-12-30 10:48:29

+0

Funky,您的問題的BIG問題是您忘記向我們展示應用了轉換的XML文檔。請提供完整(但儘可能小)的源XML文檔,完整的XSLT轉換代碼和轉換所需的結果 - 然後人們將能夠及時提供幫助。如果沒有這些信息,我們不得不*猜測* promothumbImage實際包含哪些元素。沒有任何保證,這種猜測有時是正確的,這不是天氣預報論壇。 – 2011-12-30 13:03:31

回答

1

上傳意味着元素promothumbImage返回圖像的URL,因此以下內容應顯示在頁面上:

<img src="{promothumbImage}" alt=""/> 
+0

謝謝,我試過,但它沒有渲染。是因爲它在循環中嗎? – Funky 2011-12-30 11:24:07

+0

不,$ currentPage/promothumbImage應該在循環中工作。你可以做並將結果粘貼到你的問題中? – Rickard 2011-12-30 13:04:14

0

我找到了答案,用途:

<img src="{promothumImage}" /> 

從在文檔類型的「上傳」設置顯示圖像

+1

aha,但由於您正在循環其他文檔promothumImage不是$ currentPage的一部分,您從未說過:) – Rickard 2011-12-30 13:13:09

0

使用可以簡單地使用你的像場throght媒體選取數據類型的模板:

<img class="className" src='<umbraco:Item field="infoGraphic" runat="server" Xslt="umbraco.library:GetMedia({0},false())/umbracoFile"/>'/>