Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3673002
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:40:42+00:00 2026-05-19T02:40:42+00:00

Hi I wanted help in a situation where I have a folder called ‘slides’

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:40:43+00:00Added an answer on May 19, 2026 at 2:40 am

    You could use

    foreach(glob('slides/*.html') as $fileName) {
        $fname = basename( $fileName );
        $curArr = file($fname);
        $slides[$fname ]['title'] = $curArr[0];
        $slides[$fname ]['image-links'] = $curArr[1];
        $slides[$fname ]['description'] = $curArr[2];
    }
    

    and you will end up with one big $slides array which will have the filenames as keys and the 3 sub keys, title, image-links, and description. This is assuming that each of the “slides” have the extension .html and that the content of each slide is definitively on 3 lines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted following output from Zend_Form please help <form ...> <div class=labels><b>Name:</b></div> <input type=text
I wanted to see what folks thought were the best way to help junior
I wanted to do something like this: <asp:Label ID=lblMyLabel onclick=lblMyLabel_Click runat=server>My Label</asp:Label> I know
I have a situation where I need to update a control referenced in a
I have a situation where I need to generate a bunch of C# code
I have a situation where we want to prevent the update of a table
On several occations, I have faced the situation that the default.aspx page on a
I wanted to ask if anyone could help he get this code to work.
HI Everybody I wanted to use caching in my application can any one help
I wanted to read .bak files that are the backup files of my ms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.