简体   繁体   中英

magento custom CMS page add javascript

i am following this howto to add a custom CMS page http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/0_-_theming_in_magento/adding_cms_layout_templates

the issue i am having is that i want to add a NivoSlider javascript just to this page and the only way to add it to the is to do it through the Admin -> CMS -> Pages and then change the Layout Update XML by adding the

<reference name="head">
<action method="addJs">
<script>nivo-slider/jquery.nivo.slider.js</script>
</action>
<action method="addCss">
<script>css/nivo-slider.css
</script></action>
</reference>

is there a way to add the javascript on the filesystem rather then through the Admin -> CMS -> Pages -> Page -> Layout Update XML interface?

any advise much appreciated

You can override page.xml in your layouts folder of your theme and add the script globally like,

<action method="addJs"><script>nivo-slider/jquery.nivo.slider.js</script></action>

You can just write the code directly to your CMS page in the backend as you would write it normally. You can just use <style></style> and/or <script></script> tags and write your CMS site specific code into it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM