2012-07-26 30 views
3

我正在使用 plone/document?ajax_load=True&ajax_include_head=True作爲iframe的src在重疊中顯示文檔的內容。使用重氮與notheme添加課程到身體標記

在開發模式追加&diazo.off=1做了伎倆。 生產服務器這個可悲的是不起作用的,所以我說的 ajax_load參數作爲documentation of plone.app.theming

我包裹着我的所有指令在<rules if-not="$ajax_load">元建議,以確保不會應用它們(見下面的代碼)

現在我需要具有一定的階級,以紀念的iFrame網頁的正文應用不同的樣式(例如,用於覆蓋身體無背景色)

提出了一個nearly similar question的解決方案並只有當你的工作使用具有類屬性的body元素的主題進行操作。

有沒有一種方法可以在沒有主題(使用)的情況下將內容添加到內容中? 或我必須提供一個空的HTML文檔(index2.html)作爲主題,並應用大量的規則複製通過CSS/JS等兩次?

<rules if="$ajax_load"> 

    <!-- theme href="index.html" /--> 

    <notheme /> 


    <!-- only works when using a theme --> 
    <before theme-children="/html/body"><xsl:attribute name="class"><xsl:value-of select="/html/body/@class"/> my class</xsl:attribute></before> 


    <!-- thought this could to the trick but does not work at all --> 
    <xsl:template match="html/body"> 
    <xsl:attribute name="class"> foo</xsl:attribute> 
    </xsl:template> 


</rules> 

<rules if-not="$ajax_load"> 


    <theme href="index.html" /> 

    <replace content="/html/head/title" theme="/html/head/title" /> 
    ... 

回答

3

顯然沒有主題進行操作,任何規則refe放棄主題不適用於<notheme/>。然而,您可以在<drop><replace>內容(我有關於如何實現<before><after>內容的想法,但它很難實現,也許在未來的Diazo版本中)。但是,您可以使用少量的xslt:

<replace content="/html/body/@class"> 
    <xsl:attribute name="class"><xsl:value-of select="."/> newclass</xsl:attribute> 
</replace> 
+1

感謝澄清laurence。不知道,實際上需要一個主題前後(重氮和它的文檔http://docs.diazo.org/en/latest/basic.html#rule-directives隱藏這些實施細節) 您提出的解決方案適用於我,但實際上內容主體的CSS類不會被複制。生成的body元素中唯一的類是newclass。 – fRiSi 2012-07-30 07:52:25

+1

嘗試''而不是''「。 – 2012-07-30 17:11:59

+0

做到了。謝謝 – fRiSi 2012-08-01 07:25:38

1

如果您使用plone.app.jquerytools您的疊加,那麼你可以傳遞類參數:

$('a.myPopover').prepOverlay({ 
    subtype: 'iframe', 
    cssclass: 'my-popover' 
}); 

在某些使用plone.app.tiles我們的項目,我們使用一個特定的對於覆蓋的主題模板,這是去除了所有不必要的部分,並減少爲單個包裝的div和使用它,像這樣的瓷磚編輯觀點:

<theme href="minimal.html" if-path="@@edit-tile" /> 
+0

謝謝christoph。將css-class應用於持有疊加層的div,因此無法在iframe疊加層中設置正文的樣式。 – fRiSi 2012-07-30 07:26:06