Jump to content

blinks58

Members
  • Posts

    11
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

blinks58's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Solved: $newXML = ""; $xmlString = Fedora_API::callGetDatastreamContents($this->pid, 'MODS', true); $doc = DOMDocument::loadXML($xmlString); $xpath = new DOMXPath($doc); $fieldNodeList = $xpath->query("/identifier"); foreach($fieldNodeList as $node){ $node->parentNode->removeChild($node); } $newXML = $doc->SaveXML(); /
  2. I'm trying to delete the <identifier> node of some XML, using the following code; unsuccessfully. Can someone help me identify where I'm going wrong? TIA $newXML = ""; $xmlString = Fedora_API::callGetDatastreamContents($this->pid, 'MODS', true); $doc = DOMDocument::loadXML($xmlString); $xpath = new DOMXPath($doc); $fieldNodeList = $xpath->query("/identifier"); foreach ($fieldNodeList as $node) { $fieldNodeList->removeChild($node); } $newXML = $doc->SaveXML();
  3. Thanks heaps, Irate. With your array_push suggestion, I was finally able to figure it out.
  4. Thanks for your help, pbs. I'm not having much luck, though, as these two functions just append one array to the bottom of the other, without doing the combining bit.
  5. I have 2 arrays : $array1= Array ( [0] => Array ( [id] => 411 [pa] => book [rm] => 32) [1] => Array ( [id] => 974 [pa] => journal [rm] => 76) [2] => Array ( [id] => 3041 [pa] => book [rm] => 85 ) [3] => Array ( [id] => 3852 [pa] => paper [rm] => 60 ) ) $array2= Array ( [0] => Array ( [AU] => 3041 [NL] => 1490240 [CID] => 52 [1] => Array ( [AU] => 974 [NL] => 1490241 [CID] => 76 [2] => Array ( [AU] => 390 [NL] => 1491023 [CID] => 56 ) ) where the id field in $array1 should match the AU field in $array2 (although there won't always be a match in $array2). I want to combine the 2 arrays into 1, where all the rows in $array1 are retained, along with any fields in $array2 that are not in $array1. Like this - Array ( [0] => Array ( [id] => 411 [pa] => book [rm] => 32) [NL] => [CID] => ) [1] => Array ( [id] => 974 [pa] => journal [rm] => 76) [NL] => 1490241 [CID] => 76 ) [2] => Array ( [id] => 3041 [pa] => book [rm] => 85 [NL] => 1490240 [CID] => 52 ) [3] => Array ( [id] => 3852 [pa] => paper [rm] => 60 [NL] => [CID] => ) ) I'd appreciate some assistance about how best to do this. I've been using various combinations of in_array so far, with no luck.
  6. I have the following array, called $list: Array ( [info] => Array ( [total_rows] => 29619 [page_rows] => ) => Array ( [0] => Array ( [title] => Barbie => blue ) [1] => Array ( [title] => Teddy bears = red ) ) I am able to successfully echo $list['info']['total_rows']; However, I can't figure out how to echo or print_r the "Barbie" line. echo $list['list'][0]['title']; won't work. TIA
  7. Thanks akphidelit2007. Yes, that is a simple solution. I just thought there would be a "proper" way to do it, rather than what is effectively a hack. Your solution does work. Thank you.
  8. I thought this one would be easy, but it isn't! I want to convert years only to YYYYMMDD format, e.g. 2010 becomes 20100101. But $date = date('Ymd', strtotime(2000)); throws up today's date, viz. 20130326. Any suggestions?
  9. Thanks heaps thehippy! Plain old PHP code works. For some reason, I was thinking there had to be specific Zend code to replace the PEAR code. Wasn't aware of the SQL query builders in Zend either. Regards
  10. Thanks for that useful reference. Here is the bit of code I've got so far, but the "while" bit is still not working - $stmt = "SELECT usr_username, usr_ldap_authentication FROM " . APP_TABLE_PREFIX . "user"; try { $res = $db->fetchAll($stmt, Zend_Db::FETCH_ASSOC); } catch(Exception $ex) { $log->err($ex); return ''; } print_r($res); //for each row do the following while ($row = $res->current()) { $username = $row['usr_username']; echo $username; }
  11. I am trying to convert some PEAR code to ZEND, and haven't worked with ZEND before. The code in question goes like this - //for each row in user table do the following actions while ($res->fetchInto($row, DB_FETCHMODE_ASSOC)) { //do the following actions } Any assistance in starting me off by recommending an equivalent ZEND code for that "while" line would be much appreciated.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.