dpklt4291 2016-06-30 11:23
浏览 14
已采纳

用OCMOD替换管理员TPL文件

I'm currently teaching myself OpenCart and OCMOD. I have a basic understanding on how the system works with creating an XML mod file and uploading this through the modifications interface or directly adding the XML data into the the XML row of the modifications table.

I can successfully, using XML, search for files and either replace lines of code or insert before or after.. The basics basically. I am still yet to learn the full capabilities of XML.

My question, how can I completely override a file? Like I said, I can find, replace or add code to a file by only search for a single line but as in the example below, when I try to search for the whole file and do a simple replace it will not work.

<!-- admin dashboard overide -->
<file path="admin/view/template/common/dashboard.tpl">
  <operation>
    <!-- search the whole file??? -->
    <search>
      <![CDATA[
        <?php echo $header; ?><?php echo $column_left; ?>
        <div id="content">
          <div class="page-header">
            <div class="container-fluid">
              <h1><?php echo $heading_title; ?></h1>
              <ul class="breadcrumb">
                <?php foreach ($breadcrumbs as $breadcrumb) { ?>
                <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
                <?php } ?>
              </ul>
            </div>
          </div>
          <div class="container-fluid">
            <?php if ($error_install) { ?>
            <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_install; ?>
              <button type="button" class="close" data-dismiss="alert">&times;</button>
            </div>
            <?php } ?>
            <div class="row">
              <div class="col-lg-3 col-md-3 col-sm-6"><?php echo $order; ?></div>
              <div class="col-lg-3 col-md-3 col-sm-6"><?php echo $sale; ?></div>
              <div class="col-lg-3 col-md-3 col-sm-6"><?php echo $customer; ?></div>
              <div class="col-lg-3 col-md-3 col-sm-6"><?php echo $online; ?></div>
            </div>
            <div class="row">
              <div class="col-lg-6 col-md-12 col-sx-12 col-sm-12"><?php echo $map; ?></div>
              <div class="col-lg-6 col-md-12 col-sx-12 col-sm-12"><?php echo $chart; ?></div>
            </div>
            <div class="row">
              <div class="col-lg-4 col-md-12 col-sm-12 col-sx-12"><?php echo $activity; ?></div>
              <div class="col-lg-8 col-md-12 col-sm-12 col-sx-12"> <?php echo $recent; ?> </div>
            </div>
          </div>
        </div>
        <?php echo $footer; ?>
      ]]>
    </search>

    <!-- replace whole file with below -->
    <add position="replace">
      <![CDATA[
        <div class="col-xs-12">OCMOD MODIFIED WORKING????? </div>
      ]]>
    </add>

  </operation>
</file> 
  • 写回答

2条回答 默认 最新

  • dqnek0079 2016-06-30 12:35
    关注

    You can use offset as an attribute for search and number of lines in the file as its value:

    offset="35"
    

    This works for me:

    <file path="admin/view/template/common/dashboard.tpl">
          <operation>
            <search offset="35">
              <![CDATA[<?php echo $header; ?><?php echo $column_left; ?>]]>
            </search>
            <add position="replace">
              <![CDATA[
                <div class="col-xs-12">OCMOD MODIFIED WORKING????? </div>
              ]]>
            </add>
          </operation>
        </file>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度