FARCRY TIP-OF-THE-DAY 2004-01-26: Use Nav Aliases to reduce the dependency of your code on hard-wired object ID's.
Whoops... sorry for the typo in the subject! In my last tip I described how you can use a Nav Alias to help provide links to be able to QUICKZOOM to deeper portions of a Navigation Tree without having to do lots of clicking. But Nav Aliases are much more useful than that. You may remember that I said that all the Nav Aliases get loaded into the application.navid structure (a bit like loading all the Nav Aliens into a spaceship). To reload this structure when you add or modify Nav Aliases you append an &updateapp=1 (more commonly called "doing an updateapp") to the end of a FarCry URL. Trekkies may like to think of this as "Beam us up Scotty!". I also said that you should stick to a naming convention for your Nav Aliases that mimics the CFMX variable naming conventions (which is not completely true but is a good place to start and will be assumed for this TIP). If you browse (search for .navid. ) through some of the FarCry code that comes with the distribution, you will find the following in a few places: #application.navid.home# You may find a few others too. These are NOT hardcoded into FarCry (as such). They are variables that are created according to the Nav Aliases and that are stored with each navigation node. They contain the current objectID of that navigation node. If the object ID changes for some reason (e.g. you decide another nav node should be "home" or if you completely decide to recreate your navigation tree) none of your code that uses #application.navid.home# will have to change (because the next time you updateapp the variable will get the current navigation object ID associated with that Nav Alias). How might you use this ?? Well, on the new ABN AMRO Morgans website we have used it to produce our little "quick links" section for things like Contact Us, Search and Sitemap. These links are part of the template we are using but are hooked up to Nav Aliases instead of hard-coded objectID's. This means that we can move things around in the nav or re-designate pages for these functions, without having to change the template. I am sure you can think of other places you want a soft-coded link like this (e.g. in your pages footer for things like Feedback, Disclaimer, Privacy, etc.) Have fun, and don't let the Nav Aliens get you. [PS - Tomorrow's tip will be titled "Start Simple"] --- You are currently subscribed to farcry-dev as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia http://www.mxdu.com/ + 24-25 February, 2004
