2012-07-12 36 views
1

我想第一次使用VQMOD,並且當我將下面的代碼添加到我的頁面時沒有任何更改。問題在OpenCart中使用VQMOD在header.tpl中更改簡單文本

我試圖在主頁(打開車)右上角的home鏈接改爲my home,但文本並沒有改變。不幸的是,VQMOD經理沒有錯誤。

我的XML代碼是在下面。我是否需要向我的TPL添加某些內容或進行其他更改?

<modification> 
    <file name="catalog/view/theme/*/template/common/header.tpl"> 
     <operation> 
      <search position="replace"><![CDATA[<?php echo $text_home; ?>]]></search>   
      <add><![CDATA[my home]]></add> 
     </operation>  
    </file>  
</modification> 
+0

我一直與vqmod同樣的問題,它只是完全安裝後沒有反應,所以我恢復到編輯f iles手動。這不適合你嗎? – Cleverbot 2012-07-13 15:09:48

+0

如果您安裝vQmod後還沒有發生任何問題,那麼在必要的文件夾上權限不正確或者在index.php文件中沒有發生安裝 – 2012-11-25 17:22:09

回答

3

您無法像代碼中那樣替換header.tpl。 VQMOD「只能搜索單行」不是特定的變量。

試試這個代碼:

<file name="catalog/view/theme/*/template/common/header.tpl"> 
    <operation> 
     <search position="replace"><![CDATA[ 
      <div class="links"><a href="<?php echo $home; ?>"><?php echo $text_home; ?></a><a href="<?php echo $wishlist; ?>" id="wishlist-total"><?php echo $text_wishlist; ?></a><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a><a href="<?php echo $shopping_cart; ?>"><?php echo $text_shopping_cart; ?></a><a href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a></div> 
     ]]> 
     </search> 
     <add><![CDATA[ 
      <div class="links"><a href="<?php echo $home; ?>">your own link</a><a href="<?php echo $home; ?>"><?php echo $text_home; ?></a><a href="<?php echo $wishlist; ?>" id="wishlist-total"><?php echo $text_wishlist; ?></a><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a><a href="<?php echo $shopping_cart; ?>"><?php echo $text_shopping_cart; ?></a><a href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a></div> 
     ]]> 
     </add> 
    </operation> 
</file> 
1

的一兩件事,我看準缺少的直線距離是頂部的修改細節丟失

<id>Mod Name</id> 
<version>1.0.0</version> 
<vqmver>2.X</vqmver> 
<author>Your name</author> 

你真的應該有這樣的代碼太在xml文件的頂部

<?xml version="1.0" encoding="UTF-8"?> 
0

您在* .tpl中包含()或require()或require_once()文件

require ('catalog/view/theme/*/template/product/*.tpl'); 

修改

require($vqmod->modCheck('catalog/view/theme/*/template/product/*.tpl')); 

<?php 
global $vqmod; 
require($vqmod->modCheck('file/path/here')); 
?> 

或修改vqmod_opencart.xml

<file name="path/ *.tpl"> 
     <operation> 
      <search position="replace" regex="true"><![CDATA[~require\(([^)]+)~]]></search> 
      <add><![CDATA[require($vqmod->modCheck($1)]]></add> 
     </operation> 
</file>