Re: quick and easy
| From: | Darrell Brogdon | Date: | Fri, 18 Jan 2002 19:06:23 +0000 |
| Subject: | Re: quick and easy | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-77460@lists.php.net to get a copy of this message | ||
This is a php-general list question but here goes anyway:
$openingItemTag = "<item>\n";
$openingEntry = ' <entry ';
$numberAtt = 'number="';
$nameAtt = '" name="';
$dateAtt = '" date="';
$messageAtt = '" message="';
$linkAtt = '" link="';
$closingEntry = "\"/>\n";
$closingItemTag = "</item>\n";
NOTE: this is untested but it should work.
-Darrell
travis wrote:
just a quick syntax question: here is my php <? $openingItemTag = "<item>\n"; $openingEntry = " <entry "; $numberAtt = "number="; $nameAtt = "name="; $dateAtt = "date="; $messageAtt = "message="; $linkAtt = "link="; $closingEntry = "/>\n"; $closingItemTag = "</item>"; $Entry= $openingEntry.$numberAtt.$myNumber.$nameAtt.$myName.$dateAtt.$myDate. $messageAtt.$myMessage. $linkAtt.$myLink.$closingEntry; $Item = $openingItemTag.$Entry.$closingItemTag; $fp = fopen ("news.xml", "a"); fwrite($fp,$Item); fclose($fp); ?> if done twice it returns this: <item> <entry number=01name=travisdate=01.08.02message=hello worldlink=http://www.me.com/> </item><item> <entry number=01name=travisdate=01.08.02message=hello worldlink=http://www.me.com/> </item> i want it to display as follows: <item> <entry number="01" name="travis" date="01.08.02" message="hello world" link="http://www.me.com/"> </item> <item> <entry number="01" name="travis" date="01.08.02" message="hello world" link="http://www.me.com/"> </item> now it is writing to the file I want perfectly....but but but I need to add quotes around the attributes and spaces between each attribute, and a line break before each item what do I need to add to $Entry to get that to display correctly-- Darrell Brogdon http://darrell.brogdon.net 1024D/D7FB6981 3CB8 A14D 1662 8351 11F6 40C1 D205 2D97 D7FB 6981