Dynamic Array using glob?


Posted on 16th Feb 2014 07:03 pm by admin

Is there an easier way to do this?

I am trying to get create a dyamic array based on files within the folder.

Did you know?Explore Trending and Topic pages for more stories like this.
Code: foreach (glob("*.jpg") as $filename) {
$items = array("title" => $filename)
}

$output = '<?xml version="1.0" encoding="ISO-8859-1"?>';
$output .= '<rss version="2.0">';
$output .= "<channel>";
$output .= "<title>" . $channel["title"] . "</title>";
$output .= "<description>" . $channel["description"] . "</description>";
$output .= "<link>" . $channel["link"] . "</link>";
$output .= "<copyright>" . $channel["copyright"] . "</copyright>";

foreach ($items as $item) {
$output .= "<item>";
$output .= "<title>" . $item["title"] . "</title>";
$output .= "</item>";
}
$output .= "</channel>";
$output .= "</rss>";

header("Content-Type: application/rss+xml; charset=ISO-8859-1");
echo $output;
?>
No comments posted yet

Your Answer:

Login to answer
216 Like 32 Dislike
Previous forums Next forums
Other forums

need help in php variable
i have a php variable on one page
Code: [Select]$lastId = mysql_insert_id($db);
echo $lastId;<

Recording popularity by day, week.. all time?
Hey everyone, I'm creating a site designed around users uploading music. How can I implement a syste

Deleting a record php
Attempting to setup delete a record page. The below code I put together doesn't seem to work.

Looking for help reading a .txt or .ini file and outputting the info.
I have a file called Info.ini and It has the following info:
Code: [General]
Online=0
I wou

FlashVar function how to insert variables
Hi guys. Im new in this forum and also new in php programming. Can you help me about this code?
<

Simple image grab script.
I was wondering if it was possible and if anyone knew how to make a simple php script that looks at

Table colours fail when extra row added
Hey Gurus,

I got a weird problem with formating the colour of a table made in php. Everything

Phase Error I can't seem to find :(`
Hey guys, I can seem to find my phase error on this. I am getting this error

[error]
Pars

Storing the referrer in session... problems with tabs
Hello All

I am currently working on an ERP project based on the MVC methodology, when a user

Custom Container in module pool program
Hello everyone,

I have created a custom control in my module pool screen. Now I want to s

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash