在xml文件中搜索多行

时间:2014-02-13 11:38:13

标签: php xml opencart vqmod

我正在打开购物车中的多供应商扩展,我想在vqmod的XML文件中进行更改。我想在我的一些文件中添加代码。我要添加的代码是在if和for语句之后,所以我需要搜索这些行并添加我的代码。但我刚才知道XML不允许我在文件中搜索多行。任何人都可以帮助我,这样我就可以搜索这些行,然后再添加我的代码。

1 个答案:

答案 0 :(得分:0)

在此处阅读完整的vqmod wiki https://code.google.com/p/vqmod/wiki/Scripting

您的任务可以使用搜索标记中的offest属性完成,引用来自vqmod wiki

Optional attribute "offset" to work with the position
if the search position is before and offset 3 it will put the add data before the line, 3 lines above the searched line
if the search position is after and offset 3 it will put the add data after the line, 3 lines below the searched line
if the search position is replace and offset 3 it will remove the code from the search line and the next 3 lines and replace it with the add data
if the search position is top and offset 3 it will put the code before the line, 3 lines below the top of the file
if the search position is bottom and offset 3 it will put the code after the line, 3 lines above the bottom of the file