I am working on multi-vendor extension in open cart and i want to make changes in vqmod's XML file. I want to add code in some of my files. The code that i want to add is after the if and for statements, so i need to search those lines and add my code. But i just came to know that XML does not allow me to search multiple lines in a file. Can any one help me out here so that i can search those lines and then add my code thereafter.
Asked
Active
Viewed 691 times
1
-
Take a look at `xpath`, it'll find multiple nodes for you ,a Google Search or two should set you right. – Anthony Sterling Feb 13 '14 at 11:40
-
Is it about editing the XML file through PHP or just manually using text editor? – shadyyx Feb 13 '14 at 11:42
-
i am editing the xml file so that i can make changes in the php files like index.php. – saurabh Feb 13 '14 at 11:44
-
If i understood correctly and you want to search for each occurrence of a specified code in your file and edit all of them, then you can not use vqmod for it, as vqmod its limited to one occurrence per file. you would have to add different operation tags for each case. – Jonid Bendo Feb 13 '14 at 14:20
-
1@JonidBendo there is an `index` attribute for that in vQmod – Chetan Paliwal Feb 13 '14 at 16:00
-
@ChetanPaliwal this seems to be right, please if you know a way to add all instances with index in a single file, excluding none, add it to your answer as this seems to be what the question is initially for. – Jonid Bendo Feb 13 '14 at 16:18
1 Answers
0
Read the Complete vqmod wiki here https://code.google.com/p/vqmod/wiki/Scripting
Your task can be done using offest attribute in search tag, quoting from the 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

Chetan Paliwal
- 1,620
- 2
- 15
- 24