PHP Simple HTML DOM Parser

SasukeX

New Member
How come you can't use the Class's traversing methods with variable's to set the parametersFor instance Using this array:\[code\]array(0 => array('element' => 'img[src=http://stackoverflow.com/questions/3816780/images/more.gif]', 'attribute' => 'parent()->href'));\[/code\]this works:\[code\]foreach($this->contents->find($target[$key]['element']) as $keyz => $found) { $this->store[$keyz] = $found->parent()->href}\[/code\]But this doesn't:\[code\]foreach($this->contents->find($target[$key]['element']) as $keyz => $found) { $this->store[$keyz] = $found->$target[$key]['attribute']; }\[/code\]I have tried changing they array like so:\[code\]array(0 => array('element' => 'img[src=http://stackoverflow.com/questions/3816780/images/more.gif]', 'traverse' => 'parent()', 'attribute' => 'href')\[/code\]And then trying:\[code\]foreach($this->contents->find($target[$key]['element']) as $keyz => $found) { $this->store[$keyz] = $found->$target[$key]['traverse']->$target[$key]['attribute']; }\[/code\]doesn't work.On both failures a print_r($this->store) simply gives Array();
 
Back
Top