473,320 Members | 2,073 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

PHP5 SimpleXML with forms (CMS)

Hello,

Does anybody know any tutorial about using PHP5 SimpleXML with forms?
I have found some SimpleXML examples, but only modifying node
attributes from the php code directly.

I would like to make a simple CMS based on a page with a form
containing 2 fields (text description and picture uploader), wich data
(the text and the path to the picture file in the server) is stored in
a xml file.

Thanks in advance,

Pablo.
Jun 2 '08 #1
5 2077
Pablo wrote:
Hello,

Does anybody know any tutorial about using PHP5 SimpleXML with forms?
I have found some SimpleXML examples, but only modifying node
attributes from the php code directly.

I would like to make a simple CMS based on a page with a form
containing 2 fields (text description and picture uploader), wich data
(the text and the path to the picture file in the server) is stored in
a xml file.

Thanks in advance,

Pablo.
I think XML is the wrong tool for this. Use a database - much easier
(and faster).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #2
Thanks Jerry, but this CMS is just for updating the data shown in a
Flash site, not for a list of records in a relational DB or something
like that.

That´s why i prefer to post the variables in a xml file -or just a txt
file-, from the form to show them from the dynamic fields in the swf.
Can it be possible?

For now, I have a txt file with the variables &text=, &image=, etc.
where the swf get the data to show. If I use xml, Flash can parse the
file to show directly the attributes.

Thank you again,

Pablo.
Jun 2 '08 #3
Pablo wrote:
Thanks Jerry, but this CMS is just for updating the data shown in a
Flash site, not for a list of records in a relational DB or something
like that.
OK, but I still think it's a better way to go, especially if you're
updating the data fairly often. Remember to flock() the file before
every access (write OR read) to ensure you don't have two people
updating at the same time and no one gets a partially-written file.
That´s why i prefer to post the variables in a xml file -or just a txt
file-, from the form to show them from the dynamic fields in the swf.
Can it be possible?

For now, I have a txt file with the variables &text=, &image=, etc.
where the swf get the data to show. If I use xml, Flash can parse the
file to show directly the attributes.

Thank you again,

Pablo.
OK, you can do it, but I'm not sure this is the right way to go.

You can build your XML document with SimpleXML using addChild() and
addAttribute(), then use asXML() to write it to your file. Not too
hard, if the XML is simple.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #4
You can build your XML document with SimpleXML using addChild() and
addAttribute(), then use asXML() to write it to your file. Not too
hard, if the XML is simple.
Hi Jerry,

This is just the key of my question. How can I make the form and
simpleXML work together to write the data posted from the form in the
attributes of the xml file?

I.E. I have a form with just a text field "Description", and I have
built the xml file manually: <page1><description>text to update from
the form</description></page1>. The only thing I need is to update the
data of the node <descriptionfrom the form. That´s all. Can you give
me an example of the code that works?

Thank you so much again,

Pablo.
Jun 2 '08 #5
Pablo wrote:
>You can build your XML document with SimpleXML using addChild() and
addAttribute(), then use asXML() to write it to your file. Not too
hard, if the XML is simple.

Hi Jerry,

This is just the key of my question. How can I make the form and
simpleXML work together to write the data posted from the form in the
attributes of the xml file?

I.E. I have a form with just a text field "Description", and I have
built the xml file manually: <page1><description>text to update from
the form</description></page1>. The only thing I need is to update the
data of the node <descriptionfrom the form. That´s all. Can you give
me an example of the code that works?

Thank you so much again,

Pablo.
You just need to load the file into the class, then set the element, i.e.

$xml->page1->description = (new description here)

Finally, write the entire object back to the file.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Berislav Lopac | last post by:
Has anyone thought of developing a library aimed for PHP4 which would give the kind of functionality that PHP5 has when it comes to working with XML...
0
by: Joe | last post by:
Hey everyone I'm trying to use php to extract data from an AS/400 system. The php engine is running locally on my workstation(win2000) and I'm accessing the DB2 database on the AS/400 system via...
2
by: Markus Ernst | last post by:
Hi In my application I have lots of require statements that include files residing in the same directory: index.php requires: require_once($_SERVER."/modules/cms/classes/page.php"); ...
4
by: Skeets | last post by:
When the data structure looks like this: <page> <point id="1"> <premise> 1+1=2 </premise> </point> <point id="2"> <premise> round is better than square </premise> </point> <thought id="1">
1
by: elyob | last post by:
Hi guys, I'm trying to output from an XML string and am having no luck. I'm using PHP5 here. If I print_r the array I get all the results plus extra text, but am unable to extract the individual...
5
by: voronwae | last post by:
Hi folks. Either I'm missing something really obvious (most likely) or I'm missing something really subtle. I've been building up a machine as an IMP webmail server, with php 5.1.2, cyrus-sasl,...
2
by: mandric | last post by:
Hello, Can someone please enlighten me on how to preserve the <!]> element when parsing an xml file or string with simplexml. I'm using libxml 2.6.16 and php 5.1.4. I tried a few variations,...
5
by: Marian Steinbach | last post by:
Howdy! I am just switching from PHP4 to PHP5. Since there are many different ways to create XML in PHP5, I'd like to know from the community which one would be suited best for a REST web service...
2
by: Weston | last post by:
Poking around with XPath using SimpleXML, it looks like there are at least a few reasonably common XPath operators and predicates that aren't supported. I'd like to check my observations against...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.