How do I parse a data from txt file using php? here is my variables.txt file
TITLE=Job=test
IMAGES=image1.jpg,image2.jpg,image3.jpg
IMAGES2=image3.jpg,image2.jpg,image1.jpg
and here is the html file template
<!DOCTYPE html>
<html>
<head>
<title>++TITLE++</title>
</head>
<body>
<h1>++TITLE++</h1>
<p>This is a template file where you have to swap the variables between the double plus signs (++VAR++) with the values in variables.txt.</p>
<p>You should write a class that is the template engine. This engine should support the following functions: replace variables, include subtemplates, support loops.</p>
<ul>
--for ++IMAGES++ as IMAGE--
<li>--include image.html with IMAGE--</li>
--endfor--
</ul>
<ul>
--for ++IMAGES2++ as IMAGE--
<li>--include image.html with IMAGE--</li>
--endfor--
</ul>
</body>
</html>
I have an images folder with 3 images image1.jpg, image2.jpg, and image3.jpg
The output should look like
Job=test
- image1.jpg here
- image2.jpg here
image3.jpg here
image3.jpg here
- image2.jpg here
- image1.jpg here