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.

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

array_map() probably obvious mistake
The code below is part of a class to escape strings, but should also accept an array, using array_ma

Help with lottery style system?
I'm working on a currency system for forums and it is going to have a type of lottery system built i

frame help
on the bottom frame is menu.html

Code: <body><form action='link.php' met

Lack of simpleXML Documentation
What is up with this.

Look at: http://www.php.net/manual/en/function.simplexml-load-file.php<

The repetition structure: the while statement not working
New programming student, have assignment as follows:
A restaurant has 4 lunch combos for custom

Need help with a mail notify function
I was tasked with setting up a site that's been prewritten. The site is basically a form that captur

Error when call dll from oracle
Hi all, please help me!

I have dll write C language, I want call it from oracle procedur

Help with looping
I have a comma separated list of colors taken from a database ($ICo) and a directory of images named

Help Import Animoto and Youtube
CAn someone help me urgently want to allow users on my website to import youtube/revver/dailymotion

Display Database
I need to create a shopping cart. I found this code online: http://conceptlogic.com/jcart/
Unfort

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