You could try something a bit more semantically valuable...
Though I've never done it, I'm starting to like the idea, because it
uses xpath in the urls...
Here are things I was thinking about...
1) Names should be descriptive labels for menu items and bread crumbs
2) Element names should be used in xpath for semantically valuable URL's
as well as easy lookups in the XML document
3) XSL can be used to generate the menu and site map
4) the XML is very readable.
5) URL attributes can be added to any node to override the default
behavior which would probably be to treat the xpath as a fuseaction
(Fusebox. Etc...)
<site name="Website">
<services name="Products & Services">
<design name="Website Design"
url="/clients/new/special.cfm" />
<hosting name="Web and Email Hosting"
url="/email_host_special2005.cfm" />
<mail name="Mail Services" />
</services>
<corporate name="Corporate">
<contact name="Contact Us" />
<careers name="Careers at OurCompany, Inc." />
<mgt name="Management Team" />
</corporate>
</site>
Now you can go to something like
www.mysite.com/xnav/?site/services/design
Then you can get the Xpath of your document by getting the Query String,
<cfset nodeList = xmlSearch(navigationXml,
"//#CGI.QUERY_STRING#/ancestor-or-self::*") />
Then iterate through this list per the below...
Just a random thought I had....
Anyone do something similar? Does fusebox do this (I havent been
following the FB4 as avidly as I had wanted to...)
-Dov
-----Original Message-----
From: Barney Boisvert [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 12, 2005 8:03 PM
To: CF-Talk
Subject: Re: xml breadcrumbs
Try this
<cfset nodeList = xmlSearch(navigationXml, "//[EMAIL PROTECTED]'Tool
2']/ancestor-or-self::*") />
You'll want to change your XML so that it's recursive (use 'item'
instead of 'subitem'), and probably want to switch 'label' to 'id'
since they'll need to be unique so you can do your lookups.
This solution has nothing to do with CF7's XML functions, and everything
to do with the XPath language. That's why the docs don't give good
examples, they're showing how to use the CFML implementation, not trying
to teach you XPath. If you're going to be doing much with XML, you're
going to need to pick up a good XPath tutorial/reference. Once you've
got the basics, the w3c spec is the definitive reference, but it's thin
on examples and techniques.
cheers,
barneyb
On 4/12/05, Paul <[EMAIL PROTECTED]> wrote:
> I'm using a simple xml file for our intranet navigation (CFMX 7). I
> would now like to add breadcrumb navigation (Home > Tools > Tool 1) to
> each screen by reading the same XML file, and I've never really used
> XML much. I'm assuming I can use the current path from the browser,
> find the node that matches it, and then search upwards to determine
> the parent links that lead back to default screen. But I don't know
how to put that plan into action.
>
> I've seen many examples in the archives about using a db structure to
> do this, but I'd like to stick w/ xml, if for no other reason than to
> learn it better.
>
> I've read the MM docs discussing the new xml functions, but the
> examples are only one level deep and I'm slow on the uptake,
> apparently. An abbreviated version of my xml file follows, hopefully
> this will be a no-brainer for some of you?
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <navigation>
>
> <item label="Home" href="/index.cfm" alt="Home"
> role="user" />
>
> <item label="Tools" href="/tools/index.cfm" alt="Tools"
> role="user">
>
> <subitem label="Tool 1" href="/tools/1.cfm"
> alt="tool 1" role="user" />
>
> <subitem label="Tool 2" href="/tools/2.cfm"
> alt="tool 2" role="user" />
>
> <subitem label="Tool 3" href="/tools/3.cfm"
> alt="tool 3" role="admin" />
>
> </item>
>
> <item label="Forms & Documents"
href="/forms/index.cfm"
> alt="" role="user" />
>
> <item label="Administration" href="/admin/index.cfm"
alt=""
> role="admin" />
>
> </navigation>
--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/
Got Gmail? I have 50 invites.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:202542
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54