Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Yuval200

  • Rank
  1. I really liked http://www.colourlovers.com.. I also really liked the programming of the site.
  2. Oh, sorry, thanks again :)I'm doing fine now XML wise, I only have a small OOP issue. I have read about the __destruct function. As I understood, the function works when the parser finish parsing the code and there is no more HTML to be wrote. Code-wise it works great. class xml { public $file, $error, $xmlfile = array(); function __construct($xmlFile) { $this->error = "<b>Class " . __CLASS__ . ":</b>"; if (!is_array($xmlFile)) die($this->error." \$xmlFile must be entered as an array."); $this->file = array(); foreach($xmlFile as $number => $xml) { $xml
  3. So I need to save all I did when I finish working with the XML document? How do I do this?
  4. Heh, that was a stupid mistake.. THANKS ALOT :)Now, I have a weird error.. This is the function: function updateXML(&$xmlPath, $xmlValue, $attributeName = false) { if (!$attributeName) return $xmlPath[0] = $xmlValue; return $xmlPath[$attributeName] = $xmlValue; } And the code: $classxml->updateXML($xml[0]->post[0]->poster, "66", "id");$classxml->updateXML($xml[0]->post[0]->content, "d");echo $xml[0]->post[0]->poster['id'] . "\n" . $xml[0]->post[0]->content; With the code above it changes the content, but the thing I noticed is when I delete the first
  5. Thanks ALOT man ! I added [0] after $xmlPath and it works great now .Now I have a problem with attributes, I updated my XML document: <?xml version="1.0" encoding="utf-8"?><posts> <post> <poster id="1337">Yuval</poster> <content>Post content</content> </post></posts> I am trying to echo the following line: echo $xml[0]->post[0]->content['id']; Doesn't work, I have tried var_dump: var_dump($xml[0]->post[0]->content['id']);var_dump((string) $xml[0]->post[0]->content['id']); First line returns null, and the second lin
  6. updateXML: function updateXML(&$xmlPath, $xmlValue, $attributeName = false) { if (!$attributeName) { echo "XMLPath:\n"; var_dump($xmlPath); echo "\nXMLValue:\n"; var_dump($xmlValue); echo "\nAttrName:\n"; var_dump($attributeName); echo "!\n"; return $xmlPath = $xmlValue; } elseif (trim($attributeName)) { //$this } } It returns the following:
  7. Yuval200

    xml and php

    After reading the XML tutorial, I recommend you use the SimpleXMLElement class
  8. Thanks , but it still doesn't work.. the function looks like this now: function updateXML(&$xmlPath, $xmlValue, $attributeName = false) { if (!$attributeName) return $xmlPath = $xmlValue; elseif (trim($attributeName)) { //$this } }
  9. Sorry, I solved that issue some time ago, now I have a new one with functions; To change the value of a tag, I need to do the following: class xml { public $file; protected $error; function __construct($xmlFile) { $this->error = "<b>Class " . __CLASS__ . ":</b>"; if (!is_array($xmlFile)) die($this->error." \$xmlFile must be entered as an array."); $this->file = array(); foreach($xmlFile as $number => $xml) { $xml = "data/{$xml}"; if (!file_exists($xml)) die($this->error." file {$xml} (<em>number {$number}</em>) doesn't exist.");
  10. Lol, you haven't hurt anything .Now, if someone could just answer my question
  11. Yeah, I remember using this way some time ago, forgot about it.. Haha, I'm not that of a beginner, Printing an array in a foreach loop isn't to difficult for me .--Another issue, how do I update existing tags? I have tried the following: echo $xml[0]->post[0]->content;$xml[0]->post[0]->content = "NOT Post content"; But it doesn't seem to work..Thanks
  12. Hello guys .Well, I have the following issue; I am using the following XML document: <?xml version="1.0" encoding="utf-8"?><posts> <post> <poster>Yuval</poster> <content>Post content</content> </post></posts> Now, I use the SimpleXMLElement class, and it really all works fine, I just don't understand something.When I use the following code: echo $xml[0]->children()->children(); It works two, and it writes "Yuval". My question: how can I access the second element (content)? I have tried several ways but nothing seems to work.Than
  13. PLEASE, can anyone give me an example with the whole thing? PLEASE
  14. Thanks, thing is.. $regex_output will be something like this:$regex_output = preg_replace("blabla", "blabla", $_POST['bla']) AND THAT IS WHAT I AM ASKING!How can I tell PHP that I want to explode the sub-string INSIDE the box. Please, can anyone help me.
  15. Thanks.. I know regex stuff, but again, can I please have an example on how to perform this?
  • Create New...