MegaZine3 Version 1 ("The Old One") > General Discussion

Feed XML data as a string

(1/1)

lucio.ferrari:
Hi all,

I'm trying to embed a megazine in a Drupal multisite. I have to use Megazine version 1, because of open source philosophy and all. To do that, it would be very handy to be able to feed XML data as a PHP generated string. After consulting the API documentation I found out there's a 'xmlData' property which can be used instead of 'xmlFile', so I tried putting this in the template:


--- Code: ---<?php
global $base_root;
$page_width = 200;
$page_height = 300;
$base = file_directory_path();
$xmlstring = <?xml version="1.0" encoding="utf-8"?><book bgcolor="0xCCCC99" pageheight="'.$page_height.'" pagewidth="'.$page_width.'" ><chapter>';

foreach($node->field_giornalino_pagine as $key => $value){
  $xmlstring .= '<page width="'.$page_width.'" height="'.$page_height.'"><img src="system/files'.str_replace($base, '', $value['filepath']).'" /></page>';
}
$xmlstring .="</chapter></book>";
?>
--- End code ---

and afterwards dinamically embedding with:


--- Code: ---<script type="text/javascript">
swfobject.embedSWF("/misc/megazine3/megazine/preloader.swf", "megazine",  "800px", "400px", "9.0.115", "/misc/megazine3/swfobject/expressInstall.swf",
                           {  xmlData : "<?php print $xmlstring; ?>,
                               minScale : 1.0,
                               maxScale : 1.0,
                               top: "auto" 
                           },
                           {
                               bgcolor : "#333333",
                               allowFullscreen : "true" 
                           },
                           {id : "megazine"});   
    </script>
--- End code ---

Unfortunately, it doesn't work: flash crashes with an error 1009, handleXmlLoadError is cited in the error chain.
I did try to pass an XML object to xmlData by

--- Code: ---var xml = new XML('<?php print $xmlstring; ?>');

--- End code ---
the result was the same...

My question is: does 'xmlData' work in v.1? How should I format the raw XML data?

Thanks

L.

Navigation

[0] Message Index

Go to full version