0

OCMod 怎么了?它不会找到代码块[我需要替换]

这是我的模组中的内容:

<?xml version="1.0" encoding="utf-8"?>
<modification>

  <file path="catalog/controller/information/information.php">

  <operation>
        <search><![CDATA[$data['breadcrumbs'] = array();]]></search>
        <add position="after"><![CDATA[$template = 'newproducts.tpl';]]></add>
  </operation>

  <operation>
        <search>
          <![CDATA[
                if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/information/information.tpl')) {
        $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/information/information.tpl', $data));
      } else {
        $this->response->setOutput($this->load->view('default/template/information/information.tpl', $data));
      }
          ]]>
        </search> 
        <add position="after"><![CDATA[echo 'booooooger';]]></add>
  </operation>

  </file>  

</modification>

第一个操作工作得很好,第二个在搜索中找不到代码块[它就在那里——我已经同步并区分了它在那里的文件]这是错误:

FILE: catalog/controller/information/information.php
CODE: $data['breadcrumbs'] = array();
LINE: 8
CODE: if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/information/information.tpl')) {
        $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/information/information.tpl', $data));
      } else {
        $this->response->setOutput($this->load->view('default/template/information/information.tpl', $data));
      }
NOT FOUND!

我已经尝试使用将 trim 属性设置为 true 和 false 的搜索......没有运气。

我怎样才能让它工作?

4

1 回答 1

0

我建议使用单行搜索,如果要搜索多行,则需要使用正则表达式或更多

<operation>
        <search>
            <![CDATA[
            $this->response->setOutput($this->load->view('default/template/information/information.tpl', $data));
            ]]>
        </search>
        <add position="after" offset="1">
         <![CDATA[
          echo 'booooooger';
         ]]>
       </add>
    </operation>
于 2016-03-06T20:23:29.420 回答