buff='',lose=1 """ This is a breadcrumb generator. A breadcrumb trail is what you get at yahoo as you traverse downward in their directory structure: computers->video->blah->etc. It shows you where you are in your site. My breadcrumbs shall follow these rules: 1) The current DTML Document shall be the last item. It will not be a link. 2) If the current DTML Document isn't index_html, then the parent crumb will be the index_html for the folder 3) All crumb names are overridable by setting the 'nickname' attribute. 4) The root folder will always be called "Home" Ciao! docwhat@gerf.org """ ## Start being crumb-y! buff = "\n\n[ " # Get the list of parents and reverse it list = context.REQUEST.PARENTS[:] list.reverse() # Iterate over all the parent objects, skipping the 'current'one # (see below for dealing with that for x in range(lose,len(list)-1): obj = list[x] url = obj.absolute_url() name = obj.title_or_id() buff = "%s\n -> %s" % (buff, url, name) # Deal with the 'current' object(s) obj = list[-1] buff = "%s\n '%s'" % (buff, obj) buff = "%s\n '%s'" % (buff, context.id) if obj != context: buff = "%s\n -> '%s'" % (buff, obj.title_or_id()) buff = "%s\n -> '%s'" % (buff, obj.title_or_id()) buff = buff + "\n]\n\n" return buff