Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
send link from PHP to XML... Need Help Please!
Old 07-28-2009, 07:17 PM send link from PHP to XML... Need Help Please!
Junior Talker

Posts: 1
Name: Alex
Trades: 0
I am trying to setup an administrative page so that users may log in and upload a file that will replace an existing file and also replace an existing link on a different web page(Flash) that draws its content from an XML file.

The user selects a file to upload. Selects a directory to upload the file to($location). And selects a name for the file($newname).

Once the file is uploaded (via PHP) the PHP script also sends information to the XML file.

The information sent to the XML file is a link generated by the information entered: $urlroot/$location/$newname
Reference:
$urlroot = www.mydomainname.com
$location= the directory that they have selected
$newname= the new name that they have given the file

The problem I run into is that when PHP sends the information to XML it has problems because of the special characters…

This is the PHP code that I have to send to XML:

$xml = simplexml_load_file("links.xml");

$sxe = new SimpleXMLElement($xml->asXML());

$links = $sxe->addChild("$location");

$links->addChild(“link”,“<![CDATA[<a href='$urlroot /$location/$newname'>$linkname</a>]]>");

$sxe->asXML("links.xml");

This is what shows up in the XML file (it already had the “links” node and I’ve edited the layout to make it easier to read, it actually comes out all on one line):

<?xml version="1.0" encoding="utf-8"?>
<links>
<TestingDirectory>
<link>
&lt;![CDATA[&lt;a href='"http://www.mydomain.com/testing/TestingDirectory/newLink.html"'&gt;newLink.html&lt;/a&gt;]]&gt;
</link>
</TestingDirectory>
</links>

As you can see the <'s and >'s don't appear...

Basically what I’m trying to figure out is how to have php send the link to xml in a new node called link inside of a new node determined by $location and then have Flash pull that information and create a link on the webpage.

I know how to load the XML into Flash just can't seem to figure out how to pass the link from PHP to XML properly...

Please help if you can...

Thanks,
Alex
PQAlex is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to send link from PHP to XML... Need Help Please!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.47282 seconds with 12 queries