Merhaba arkadaşlar hem resim, hem audio hemde video kullanabileceğim bir galeri buldum. Bilgileri config.xml dosyasından alıyor. Ben kontrol panelden youtube için link, title, description giriyorum. Bunları xml içine nasıl otomatik atabiliriz.
xml örneği aşağıda...
<?xml version="1.0"?>
-<MultimediaGallery>-<file type="video"><thumb>media/videos/thumbs/html5.png</thumb><source>http://www.youtube.com/watch?v=siOHh0uzcuY</source><description>Youtube Video: Introduction to HTML5</description></file>-<file type="audio"><thumb>media/audio/thumbs/audio1.jpg</thumb><source>media/audio/audio1.ogg</source><source>media/audio/audio1.mp3</source><description>Audio Example</description></file>-<file type="video"><thumb>media/videos/thumbs/video1.png</thumb><source>http://www.youtube.com/watch?v=irF02LNZLpE</source><description>Youtube Video: San Francisco Carnaval Grand Parade 2010</description></file>-<file type="video"><thumb>media/videos/thumbs/video2.png</thumb><source>http://www.youtube.com/watch?v=dD1H4fvdnyI</source><description>Youtube Video: San Francisco Carnival Parade 2010 Best Video</description></file>
</MultimediaGallery>
XML içinde PHP Kullanmak...
6
●1.555
- 04-02-2014, 13:16:36istizan adlı üyeden alıntı: mesajı görüntüle
echo '<'.'?'.'xml version="1.0"'.'?'.'>'; - 04-02-2014, 13:21:31Kimlik doğrulama veya yönetimden onay bekliyor.@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>";
butonuna basmayı unutmayın!