@istizan; Şu örnek sana yardımcı olacaktır.
<?php
header("Content-Type: text/xml; charset=UTF-8");
echo "<"."?"."xml version=\"1.0\" encoding=\"UTF-8\""."?".">";
/**
* Verileri direk diziden alıyorum. Sen verileri
* veritabanında çekip eklersin. Mantığı öğrenmen
* açısından bunu veriyorum.
*/
function get_results()
{
return array(
(object) array(
"type" => "video",
"thumb" => "media/videos/thumbs/html5.png",
"source" => array(
"http://www.youtube.com/watch?v=siOHh0uzcuY"
),
"description" => "Youtube Video: Introduction to HTML5"
),
(object) array(
"type" => "audio",
"thumb" => "media/audio/thumbs/audio1.jpg",
"source" => array(
"media/audio/audio1.ogg",
"media/audio/audio1.mp3"
),
"description" => "Audio Example"
),
(object) array(
"type" => "video",
"thumb" => "media/videos/thumbs/video1.png",
"source" => array(
"http://www.youtube.com/watch?v=irF02LNZLpE"
),
"description" => "Youtube Video: San Francisco Carnaval Grand Parade 2010"
),
(object) array(
"type" => "video",
"thumb" => "media/videos/thumbs/video2.png",
"source" => array(
"http://www.youtube.com/watch?v=dD1H4fvdnyI"
),
"description" => "Youtube Video: San Francisco Carnival Parade 2010 Best Video"
)
);
}
$results = get_results();
echo "<MultimediaGallery>";
foreach($results as $result)
{
echo "<file type=\"" . $result->type . "\">";
echo "<thumb>{$result->thumb}</thumb>";
foreach($result->source as $source)
{
echo "<source>{$source}</source>";
}
echo "<description>{$result->description}</description>";
echo "</file>";
}
echo "</MultimediaGallery>";