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

Get word number x from string?
How can I use a function to loop through a string, and "have a look at" every word in the

reading partial code from external site
Hi,

I am trying to write a script for my website to get an article from an external website.

Getting PHP to ammended the selected in option field
Hey Guys

thanks for everyones help so far. This site and its users are oozing awesomness.

INSERT data problem!
After having an string with apostrophes ', double quotes " or any other special characters, suc

Removing Title From database problem
Hi again ! i am having an issue with updating database. When i update any price of a title it remove

browse folder only
hi,
is there a way i can browse or get the directory or folder only and not the file?
i just w

Can php detect connection speed and thereafter swap out elements?
No code to post, lads, yet. Just looking for a yay or nay at this stage:

Can a php script be

Help with setcookie()
Merry Xmas to those on this foruum
Older guy here with some experience but not allot so please be

Converting from one format to another
"I have got a date in DD/MM/YYYY but I need it in MM-DD-YYYY. Help!"

Posting to another Site?
I have software that people install.
When they install it, is there a way to make it post their d

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