File:  [mozdev] / bbecontainer / www / persistance_xml.php
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Wed Nov 18 16:30:09 2009 UTC (7 years, 11 months ago) by moonwalker
Branches: MAIN
CVS tags: HEAD
*** empty log message ***

<?php

$xml=new DOMDocument();	$xml->load(  'menu.xml');
$prime_menu=array();

	$node=$xml->documentElement->firstChild;  $id=0;
	while ($node)
	{
		if($node->nodeName=='link') {
			$obj=array('id'=>$id ,
			'title'=>$node->getAttributeNode('title')->value,
			'owner_item'=>0,
			'content_fname'=>$node->getAttributeNode('content_fname')->value
			);
			array_push($prime_menu , $obj );	
		} else if ($node->nodeName=='submenu') {
			$xml_submenu=$node;
			$submenu=array(
			'id'=>$id ,
			'title'=>$xml_submenu->getAttributeNode('title')->value,
			'owner_item'=>0,  'pages'=>array() ,
			);

			$nodes=$xml_submenu->getElementsByTagName('link');
			for($i=0;$i<$nodes->length;$i++) {
				$obj=array(
				'title'=>$nodes->item($i)->getAttributeNode('title')->value,
				'content_fname'=>$nodes->item($i)->getAttributeNode('content_fname')->value
				);
				array_push(	$submenu['pages'] , $obj );
			}
			array_push($prime_menu , $submenu );	
		}
	$node=$node->nextSibling; $id=$id+1;
	}


?>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>