[dokuwiki] Re: useheading question

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sat, 18 Aug 2007 11:10:03 +0100

Jason Keltz wrote:
Hi Chris,

I know we closed this issue back at the start of August, but I just wanted to let you know that I realized today that I don't think it's 100% resolved. If you are using the "use first heading" option, and the hierarchical breadcrumbs, and you come to a brand new DokuWiki site that doesn't yet have the data cached yet, and you visit a link other than "start", then you will only see the proper heading information for the link that you visit in the breadcrumb bar, while you will still see just IDs for the namespaces leading up to your page. The breadcrumbs function needs to load metadata for the whole path if it hasn't yet been loaded, and not just the metadata for the current ID.

This shouldn't be happening. If it is it deserves further investigation(*). When a request is made for a first headings, it can be made with a flag that says generate metadata if it doesn't exist. In general all calls should set that flag to true. The exception being the metadata renderer. The default value of that flag is false, that was done to avoid risking endless recursion two pages require a first heading from each other. Perhaps that was incorrect. The metadata renderer is really the only risk.

Is there any function that will tell me if the metadata has already been cached for a particular ID? I have a sidebar that is generated before the breadcrumb function is called, so I called p_use_first_heading with the second option true which does work, but I'm not sure if this is the proper way to do it.
No, there is no function which tells you if there is already metadata for a particular ID. Conceivably you could see if the file for that ID exists. However I don't think that is the correct way to solve this. Metadata for a wiki page should always exist. It only doesn't exist when a page has been added to wiki externally to a DokuWiki version which supports metadata. Generating metadata for a single page is a relatively cheap operation. There is no real reason not to generate when it is required. I believe altering the flag on the first heading function will correct the problem.

Can you make the change to the default value of the $render parameter in p_get_first_heading() - from false to true and report back if that fixes the problem?


- Chris

(*) I did a search on the DW codebase, there are several calls to p_get_first_heading() which don't use the flag. Several in the tpl_youarehere() function. Also my sidebar template (:)) and some plugins. Switching the default value should fix any problems associated with any of these and is, I think, the way to go.

--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: