Nice menu breaks for anonymous user (it is fine when a user logs in) when block caching is enabled. (See attached screenshots).
The menu entries are self definied and link to certain nodes. If you turn off block caching is works also for anonymous users. Didn't look at the code so I just guess it is a nice menu problem (and not a drupal core caching problem).

Drupal core 6-rc2 and nice menus 6-rc1 where used.

Comments

add1sun’s picture

Hm, the nice menus CSS and JS is called in the theme function and that is not getting pulled in with the block caching. I've never dealt with block caching so I'll need to investigate. Thanks for reporting.

add1sun’s picture

Component: Miscellaneous » Code
Status: Active » Needs review
StatusFileSize
new3.45 KB

Ugh, ok so no dynamically adding the JS and CSS in the theme function (grrr.) I've moved that stuff to a hook_init so it should work now, even with caching. Please test and report back.

IcyAndy’s picture

Status: Needs review » Reviewed & tested by the community

tested and works on my test site. As some core modules also add their css and js via hook_init I think the solution is ok -> patch ready to commit

add1sun’s picture

Status: Reviewed & tested by the community » Fixed

Cool, thanks for testing. Committed to 6 branch and HEAD.

Yeah, the motivation to put CSS in the theme function rather than init is so that a) it only gets called when the theme function is called, not on every page (no need to call the CSS if it won't be used on a particular page) and b) it allows themers to monkey with it if they want to without hacking the module. But unfortunately it looks like we have to go the init route for now. :-/ Myself and co-worker are looking at how to improve that in D7.

IcyAndy’s picture

ad a.) makes sense but I guess will be some work
ad b.) That shouldn't be a problem according to the api documentation: A theme should still be able to replace the complete css file (didn't try it myself though) (see http://api.drupal.org/api/function/drupal_add_css/6)

add1sun’s picture

Yep, I guess I am actually more concerned with the hardcoded JS calls that are in the drupal_set_html_head more than the CSS really. Anyway, it was in the menu hook in 5 and that worked fine (I had moved it to the theme in 6 as a best practice - just to get dinged and essentially move it back. ;-))

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.