473,804 Members | 3,108 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating simple unordered list menu from XML?

Does anyone have any examples or links to examples of generating a
simple unordered list menu with multiple levels from an XML file? We
are redesigning the navigation on our website and I was hoping to make
this as flexible as possible.

Thanks,
Mike
Jul 17 '05 #1
1 5384
Michael Champagne scribbled something along the lines of:
Does anyone have any examples or links to examples of generating a
simple unordered list menu with multiple levels from an XML file? We
are redesigning the navigation on our website and I was hoping to make
this as flexible as possible.

Thanks,
Mike


http://www.php.net/xml

You could have a simple structure like

<?xml version="1.0"?>
<menu xmlns="http://www.example.com/menu" label="Navigati on">
<category label="My stuff">
<entry label="Chimpanz ee" href="/index/chimp"/>
<entry label="Red car" href="/index/car"/>
<category label="My weapons">
<entry label="One-handed sword" href="/index/weaps/sword"/>
<entry label="Battle Axe" href="/index/weaps/axe"/>
</category>
</category>
<category label="Random words">
<entry label="Zilch" href="/index/zilch"/>
<entry label="Squee" href="/index/squee"/>
<entry label="Splurt" href="/index/splurt/">
</category>
</menu>

And all you'd need would be a start-tag and end-tag element handler to
create the following partial HTML:

<h2>Navigatio n</h2>
<ul>
<li class="category ">My stuff<ul>
<li><a href="/index/chimp/">Chimpanze e</a></li>
<li><a href="/index/car/">Red car</a></li>
<li class="category ">My weapons<ul>
<li><a href="/index/weaps/sword/">One-handed sword</a></li>
<li><a href="/index/weaps/axe/">Battle Axe</a></li>
</ul></li>
</ul></li>
<li class="category ">Random words<ul>
<li><a href="/index/zilch/">Zilch</a></li>
<li><a href="/index/squee/">Squee</a></li>
<li><a href="/index/splurt/">Splurt</a></li>
</ul></li>
</ul>

which could for example render like this:

*Navigation*

# /My stuff/
o _Chimpanzee_
o _Red_car_
o /My weapons/
+ _One-handed_sword_
+ _Battle_Axe_
# /Random words/
o _Zilch_
o _Squee_
o _Splurt_
You could also just use XSLT, but that's a little more complicated (IMHO).
The manual should tell you enough that you can do this on your own. If
you want me to write a script for you though, feel free to transfer € 75
to my PayPal account and I'll write you a simple function that does
what I just described.
--
Alan Plum, WAD/WD, Mushroom Cloud Productions
http://www.mushroom-cloud.com/
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2274
by: Justin Archie | last post by:
The subject says it all my friends. I have searched google to death about centering problems and for some reason no one seems to have the error I have. For the past few days I have been working on a website for a non-profit club and I and they were happy with the design and layout. I did not discover a problem with what I had until I was testing all browsers for compatibility. The following page...
6
5155
by: MikeSwann | last post by:
Dear All, I am trying to decide on to create a collection object for a project that I am working on. I am fairly new to OOP so this may be on the basic side. I have looked on the groups, but can't seem to find the answer I am looking for - just more questions! I want an object to hold Case details, one of the properties of this Case class will be RequestedBy. I ideally want this property to be a collection of User Objects (which...
3
2069
by: triplejump24 | last post by:
i LOVE doing c++ programming, but i never can get myself started! Once i figure it out, its fun but anyways here it goes... Im given a file c:\temp\hwk8input.txt, which contains the records of the video collection of a small local library. There are four fields for each video: 1) A unique video ID number without space (v1, v2, etc.); 2) The full video title; 3) The availability of the video (0 for checked out and 1 for checked in); 4) A...
3
3499
by: User | last post by:
Hi, Is it possible to transform Ordered/Unordered list into navigation dropdown menus? Is this effect achieved by CSS? or via Javascript? PLease advise Thanks.
0
1344
by: roscoedesign | last post by:
html: http://roscoecreations.com/exitpro/ css: http://roscoecreations.com/exitpro/css/style.css js: http://roscoecreations.com/exitpro/javascript/main.js Recently, I have had some big problems with white space being created by IE6. Now that I have conquered that problem it has popped up again only with IE7. I have been testing this for an entire day and still no luck. I don't understand because when the page loads everything looks fine, but...
2
1700
by: vidhyapriya | last post by:
Hi all, I am creating user controls for developing menu for my application.I am not using default menu bar,creating my own menu using user controls.I want my user controls above the form.For Example in yahoo messenger, if you go to Messenger menu clicking the status menu item,the status will be listed.The status list is coming outside of the form width/above the form.I want my user control to display like yahoo messenger status list.I am using...
2
2179
by: torweb | last post by:
I'm using an image for an unordered list, which works fine. The problem is, the image is also appearing in my numbered "ordered list." Here is my code for the unordered list:...and thanks in advance: ul { font-family: Arial; font-size: 12px; color: #424E51; font-style: normal line-height: 17px; font-weight: normal; font-variant: normal;
2
2225
by: asc4john | last post by:
When including an unordered list in an unordered list: Should it be included as a "list" item as in: <ul><liitem</ li><ul.... </ul<liitem</li</ul> or included in the LI element as in: <ul><liitem</li<li<ul... </ul></li></ul>? or does it matter?
0
9575
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10564
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10073
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9134
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7609
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6846
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.