简体   繁体   English

Magento:将动态代码添加到特定CMS页面的头部

[英]Magento: Add dynamic code to head section in specific CMS Page

I'm trying for a while now to get some code into the head section of our custom 'contacts' CMS page. 我现在正在尝试将代码添加到自定义“联系人” CMS页面的开头部分。 The plan is to make this page to a configurable popup window through a backend setting (true/false). 计划是通过后端设置(true / false)使此页面进入可配置的弹出窗口。

So far I managed to rewrite the app/code/core/Mage/Page/Block/Html/ Head.php . 到目前为止,我设法重写了app / code / core / Mage / Page / Block / Html / Head.php

The problem is that any changes made to this file occur on all pages wich wouldn't make to much sense for a popup window. 问题是,对该文件所做的任何更改都会在所有页面上发生,对于弹出窗口来说意义不大。

Any ideas how to approach this? 任何想法如何解决这个问题?

Add to the Layout Update XML field of your CMS page: 添加到CMS页面的Layout Update XML字段中:

 <default>
     <reference name="head">
         <block type="core/template" name="headerInsert" template="yourthemepath/headerInsert.phtml"/>
     </reference>
 </default>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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