VQmod writing for opencar (part 2)
vQmod using *. fundamental xml as follows:
<modification>
<id>Mô tả vQmod</id>
<version>Phiên bản của file *.xml</version>
<vqmver>Phiên bản vQmod sử dụng</vqmver>
<author>Tác giả</author>
<file name="đường dẫn file cần sửa bằng vQmod">
<operation>
<search position="replace"><![CDATA[
Code cần tìm kiếm
]]></search>
<add><![CDATA[
Code cần thêm
]]></add>
</operation>
</file>
</modification>
Example 1
1. Create a new file named “replace-demo.xml”
2. Save the file with the following code:
<modification>
<id>Replace ABC with 123</id>
<version>1.0</version>
<vqmver>1.0.8</vqmver>
<author>xxx</author>
<file name="path/to/myfile.php">
<operation>
<search position="replace"><![CDATA[
$var = 'ABC';
]]></search>
<add><![CDATA[
$var = '123';
]]></add>
</operation>
</file>
</modification>
This code means finding the code $ var = ‘ABC’; in file path / to / myfile.php replaced by code $ var = ‘123 ‘;
Example 2
1. Create a new file named: “before-demo.xml”
2. Save the file with the following code:
<modification>
<id>Before ABC, add 123</id>
<version>1.0</version>
<vqmver>1.0.8</vqmver>
<author>xxx</author>
<file name="path/to/myfile.php">
<operation>
<search position="before"><![CDATA[
$var = 'ABC';
]]></search>
<add><![CDATA[
$var = '123';
]]></add>
</operation>
</file>
</modification>
This code means that the code $ var = ‘ABC’ in file path / to / myfile.php added before the code $ var = ‘123 ‘
Example 3
1. Create a new file “after-demo.xml”
2. Save the file with the following code:
<modification>
<id>After ABC, add 123</id>
<version>1.0</version>
<vqmver>1.0.8</vqmver>
<author>xxx</author>
<file name="path/to/myfile.php">
<operation>
<search position="after"><![CDATA[
$var = 'ABC';
]]></search>
<add><![CDATA[
$var = '123';
]]></add>
</operation>
</file>
</modification>
The above code means finding the $ var = ‘ABC’ in file path / to / following myfile.php added it $ var = ‘123 ‘