You are here:  » Generating a drop down menu


Generating a drop down menu

Submitted by dustin on Wed, 2006-03-15 19:43 in

How can I generate a drop down menu from XML?

Submitted by support on Wed, 2006-03-15 19:58

Hi Dustin,

Can you post an example of the XML you are working with, and i'll try and put an example script together for you...

Use the <code> tags to post the XML in this forum so that it remains formatted correctly.

Submitted by dustin on Tue, 2006-03-28 14:33

<portal>
<menu value="www....com" option="Text" />
<menu value="www....com" option="Text" />
<menu value="www....com" option="Text" />
<menu value="www....com" option="Text" />
<menu value="www....com" option="Text" />
</portal>

Something like that...

Submitted by support on Tue, 2006-03-28 16:42

Something like this should generate the drop down:

<?php
  
require("MagicParser.php");
  print 
"<select>";
  function 
myRecordHandler($record)
  {
    print 
"<option value='".$record["MENU-VALUE"]."'>".$record["MENU-OPTION"]."</option>";
  }
  print 
"</select>";
  
MagicParser_parser("options.xml","myRecordHandler","xml|MENU/");
?>

You would then need to use JavaScript to actually make a form out of that which would redirect the user to another page or website...