Hi I wanted help in a situation where I have a folder called ‘slides’ and I have multiple text / html files in it like:
slide1.html
slide2.html
slide3.html
and so on…..
The structure of these files is like this:
<h2>Title of the Slide</h2>
<p><a href="http://mydomain.com"><img src="tick_icon.jpg" width="227" height="227" alt="icon" longdesc="http://longdescription" /></a></p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
3 properties Title, Image and the Description. One in each line.
I have some 10 – 12 files like this. I wanted a function which will loop and parse all these files in the folder called 'slides' and return values of each line (of the 3 lines) as variable so that I can place them within my code for layout.
You could use
and you will end up with one big
$slidesarray which will have the filenames as keys and the 3 sub keys,title,image-links, anddescription. This is assuming that each of the “slides” have the extension .html and that the content of each slide is definitively on 3 lines.