brasofilo

Custom XML from Wordpress to Flash

Oct 6th, 2011
291
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3.  * Custom XML file to be read by Flash SWF
  4.  * Install : wp-content/config.xml.php
  5.  * Description : Grabs two custom fields from post 101 and generates a configuration XML file
  6.  * Dependencies : must adjust wp-load.php path in case this file is not inside wp-content/
  7.  * Usage : within Flash, call this XML generator: "http://yourdomain.com/wp-content/config.xml.php"
  8.  */
  9. require_once "../wp-load.php";
  10. $phone = get_post_meta(101, 'phone', true);
  11. $email = get_post_meta(101, 'email', true);
  12. $xml = <<<EOT
  13. <data>
  14.     <settings>
  15.         <phone>{$phone}</phone>
  16.         <email>{$email}</email>
  17.     </settings>
  18. </data>
  19. EOT;
  20. echo $xml;
  21. ?>
RAW Paste Data