Jump to content

php to xml help!


nade93

Recommended Posts

hi all

 

i am basically trying to recreate the xml below, using data from mysql. I can get the data off effectively, however, it is obviously not coming out in the correct format to fit into my template.

 

XML CODE

<?xml version=”1.0” encoding=”UTF-8”?>
<option>
<info><![CDATA[<p><Text_Preset_2>THIS IS THE TITLE</Text_Preset_2></p>
<Text_Preset_3> THIS IS WHERE THE CONTENT WILL GO</Text_Preset_3>

]]></info>
<extraHeight>60</extraHeight>
<!--  ______________GRADIENT SETTINGS_________________   -->
<!--  DESCRIPTION GRADIENT  -->
<descriptionGradient visible="true" />
<!--  DRAGGER GRADIENT  -->
<draggerGradient visible="true" />
<!--  ______________STROKE SETTINGS_________________   -->
<bgStroke visible="true"/>
<draggerStroke visible="true"/>
<!--  ______________COLOR SETTINGS_________________   -->
<!--  DESCRIPTION BOX  -->
<descriptionBackground>0x000000</descriptionBackground>
<descriptionStroke>0x666666</descriptionStroke>
<!--  BACKGROUND GRADIENT   -->
<bgGradientColor>0x1E1E1E</bgGradientColor>
<!--  DRAGGER  -->
<arrowsOver>0xFFCC00</arrowsOver>
<arrowsNormal>0xCCCCCC</arrowsNormal>
<strokeOver>0x666666</strokeOver>
<strokeNormal>0x333333</strokeNormal>
<draggerBgOver>0x0D0D0D</draggerBgOver>
<draggerBgNormal>0x000000</draggerBgNormal>
<draggerGradientNormal>0x333333</draggerGradientNormal>
<draggerGradientOver>0x404040</draggerGradientOver>

</option>

 

the parts below the xml option is styling for the page within a flash file and needs to be entered into the code

 

I am at present using this php coding which allows me to view the xml, however, the styling is not correct and shows up as NULL in my flash file

 

<?php
header ("content-type: text/xml");


mysql_connect("local", "db", "pw") or die(mysql_error());

mysql_select_db("db") or die(mysql_error());

$result = mysql_query("SELECT * FROM articles WHERE id=1");

$row = mysql_fetch_assoc($result);
echo '<?xml version="1.0" encoding="utf-8"?>'; 
echo "<option>\n";



$finaldata = explode("|", "Songname|location");
echo "\t<info>\n";
echo "\t\t<Text_Preset_2>" . $row['article_name'] . "</Text_Preset_2>\n";
// Escaping illegal characters
        $row['content'] = str_replace("&", "&", $row['content']);
        $row['content'] = str_replace("<", "<", $row['content']);
        $row['content'] = str_replace(">", ">", $row['content']);
        $row['content'] = str_replace("\"", """, $row['content']);

echo "\t\t<Text_Preset_3>" . $row['content'] . "</Text_Preset_3>\n";
echo "\t</info>\n";


echo "</option>\n";


?>

 

can anyone help please?

 

Link to comment
https://forums.phpfreaks.com/topic/176815-php-to-xml-help/
Share on other sites

ok got the data to show by using <![CDATA[ which works great, however i am still confused as to where to put the stle elements so they work

 

for example at the min have them like this

 

echo "<extraHeight>60</extraHeight>";
echo "<descriptionGradient visible=\"true\" />";
echo "<draggerGradient visible=\"true\" />";
echo "<bgStroke visible=\"true\"/>";
echo "<draggerStroke visible=\"true\"/>";
echo "<descriptionBackground>0x000000</descriptionBackground>";
echo "<descriptionStroke>0x666666</descriptionStroke>";
echo "<bgGradientColor>0x1E1E1E</bgGradientColor>";
echo "<arrowsOver>0xFFCC00</arrowsOver>";
echo "<arrowsNormal>0xCCCCCC</arrowsNormal>";
echo "<strokeOver>0x666666</strokeOver>";
echo "<strokeNormal>0x333333</strokeNormal>";
echo "<draggerBgOver>0x0D0D0D</draggerBgOver>";
echo "<draggerBgNormal>0x000000</draggerBgNormal>";
echo "<draggerGradientNormal>0x333333</draggerGradientNormal>";
echo "<draggerGradientOver>0x404040</draggerGradientOver>";

but they are not having any effect

Link to comment
https://forums.phpfreaks.com/topic/176815-php-to-xml-help/#findComment-932255
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.