public function action_xmlread()
{
$xml = simplexml_load_file('new.xml');
foreach($xml->body as $b)
{
foreach ($b->node as $node) {
$this->dig($node);
}
}
}
public function dig($node)
{
if(isset($node->tit) && !isset($node->url))
{
$this->dig($node);
}else{
$this->grabData($node);
}
}
public function grabData($node)
{
$category_names = array('userdef1', 'userdef2');
$url = $node->url;
$category = '';
foreach($category_names as $catname)
{
if(isset($node->$catname))
{
$category = $node->$catname;
break;
}
}
$keywords = $node->key;
$title = $node->tit;
if(empty($url) && empty($category))
{
continue;
}
$this->saveItem($title, $url, $category, $keywords);
echo $url . " , category: ". $category;
echo '<br />';
}
When I run xmlread() it dies with:
Maximum function nesting level of '100' reached, aborting!
On the
$this->dig($node);
Inside the dig() function.. How can this be solved?