用OCMOD替换admin TPL文件 [英] Replace admin TPL files with OCMOD

查看:85
本文介绍了用OCMOD替换admin TPL文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在自学OpenCart和OCMOD.我对系统如何创建XML mod文件并通过Modifys接口上传该文件或直接将XML数据添加到Modifying表的XML行中有基本的了解.

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.

我可以使用XML成功地搜索文件,并替换代码行或在之前或之后插入.我仍要学习XML的全部功能.

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> 

推荐答案

您可以将offset用作search的属性,并将文件中的行数用作其值:

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

offset="35"

这对我有用:

<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>

这篇关于用OCMOD替换admin TPL文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆