| Pages: [1] :: one page |
| Author |
Thread Statistics | Show CCP posts - 0 post(s) |

PyroTech03
Legion of Darkwind Order of the Void
2
|
Posted - 2012.04.28 19:42:00 -
[1] - Quote
Hello,
I'm new to coding and was having someone help me for a greater portion of this, but it seems they have fallen off the earth so I'm left to my own to get things finished.
I am needing something to parse the XML for the wallet journal.
Current code is this:
Quote: function saveTags($ccp_parser,$tag,$attributes='') { global $XML,$TAGS; $XML .= '<' . $TAGS[$tag]; if ($tag=='ROW') { $XML .= ' date="' . $attributes['DATE'] . '" refID="' . $attributes['REFID'] . '" refTypeID="' . $attributes['REFTYPEID'] . '" ownerName1="' . $attributes['OWNERNAME1'] . '" ownerID1="' . $attributes['OWNERID1'] . '" ownerName2="' . $attributes['OWNERNAME2'] . '" ownerID2="' . $attributes['OWNERID2'] . '"'; $XML .= ' argName1="' . $attributes['ARGNAME1'] . '" argID1="' . $attributes['ARGID1'] . '" amount="' . $attributes['AMOUNT'] . '" balance="' . $attributes['BALANCE'] . '" reason="' . $attributes['REASON'] . '" taxReceiverID="' . $attributes['TAXRECEIVERID'] . '" taxAmount="' . $attributes['TAXAMOUNT'] . '" /'; } $XML .= '>'; if ($tag=='CURRENTTIME' || $tag=='CACHEDUNTIL') $XML .= date("Y-m-d H:i:s");
This would work under old api, as the reason code just returned the reason code. but now, wallet journal reason code for player donations returns "DESC: " + the player entered text.
How would I go about removing the "DESC: " from reason codes so that the script picks it up properly? |

Desmont McCallock
166
|
Posted - 2012.04.28 19:54:00 -
[2] - Quote
Use str_replace on $attributes['REASON'] . |

PyroTech03
Legion of Darkwind Order of the Void
2
|
Posted - 2012.04.28 20:44:00 -
[3] - Quote
So should it work by doing the following right in the middle of the XML parsing?
Quote:str_replace("", "DESC: ", "$attributes['REASON']")
Or how do you actually declare a "no space" or just remove it? |

mxzf
Shovel Bros
1426
|
Posted - 2012.04.29 00:53:00 -
[4] - Quote
Yeah, you just replace "DESC: " with "" (an empty string), which is the same as just deleting the "DESC: ". |

Desmont McCallock
166
|
Posted - 2012.04.29 04:59:00 -
[5] - Quote
Actually it should be Quote:str_replace("DESC: ", "", $attributes['REASON']) |

PyroTech03
Legion of Darkwind Order of the Void
2
|
Posted - 2012.04.29 23:24:00 -
[6] - Quote
Ok thanks guys!
One more question then....
better to do it inside the xml parse bit (what I linked there) or do a seperate call after it's all been finished and run it there? |

mxzf
Shovel Bros
1442
|
Posted - 2012.04.30 00:56:00 -
[7] - Quote
PyroTech03 wrote:Ok thanks guys!
One more question then....
better to do it inside the xml parse bit (what I linked there) or do a seperate call after it's all been finished and run it there?
No reason to keep it around if you don't need it. It's kinda six of one, half-dozen of the other really, it doesn't matter a ton when you take it out, so you might as well take it out as early as you don't need it (unless it's significantly simpler to take it out later). |
| |
|
| Pages: [1] :: one page |
| First page | Previous page | Next page | Last page |