想要包含僅適用於xml文件主頁的css文件。
嘗試這樣:使用將xss添加到magento中的xml主頁
<cms_index_index>
<action add css>
.
.
</action>
</cms_index_index>
這local.xml中增加了在每個CMS頁面特定CSS。
任何想法?
在此先感謝。
想要包含僅適用於xml文件主頁的css文件。
嘗試這樣:使用將xss添加到magento中的xml主頁
<cms_index_index>
<action add css>
.
.
</action>
</cms_index_index>
這local.xml中增加了在每個CMS頁面特定CSS。
任何想法?
在此先感謝。
在CMS主頁有設計(佈局更新XML) 使用以下代碼
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/myjavascript.js</name></action>
</reference>
謝謝。有效 –
試試這個
<cms_index_index>
<reference name="your cms identifier for home page">
<action method="addCss"><stylesheet>your path/your css file name</stylesheet></action>
</reference>
</cms_index_index>
請使用此代碼local.xml
或page.xml
我不是100%肯定的代碼工作或不
沒有爲我工作。 –
結合@Leo的answer以及another blog post我最近發現,這裏有一個代碼片段,用於將自定義css添加到只有一個頁面。
<reference name="head">
<action method="addCss">
<stylesheet>css/custom.css</stylesheet>
</action>
</reference>
與@Leo提到的相同指令。
以上建議對我來說並不適用於Magento 1.7中的空白主題。什麼工作是這樣的:
<reference name="head">
<action method="addCSS">
<type>css/master.css</type>
<stylesheet>media="all"</stylesheet>
</action>
</reference>
這將產生以下代碼
<head><link rel="stylesheet" type="text/css" href="http://myshop.com/shop/skin/frontend/mytheme/blank/css/master.css" media="all"></head>
我把這個代碼放到我的主題local.xml中。
我
<cms_index_index translate="label">
<label>CMS Home Page</label>
<reference name="head">
<action method="addCss">
<stylesheet>
css/custom.css /*This is ur css path*/
</stylesheet>
</action>
</reference>
</cms_index_index>
該解決方案的工作需要更多的信息。 您的主頁是內容還是靜態塊? –