In Drupal 5 you could call drupal_get_js or drupal_get_css in hook_footer. Now those calls do not work. This might just be a documentation issue, with a recommendation to move those calls to the updated hook_init function.

Comments

theborg’s picture

I cannot reproduce it on a fresh install.
drupal_get_css() on a hook_footer function is working.

starbow’s picture

Title: Cannot call drupal_get_js or drupal_get_css in hook_footer » Cannot call drupal_add_js or drupal_add_css in hook_footer

Sorry, bad typing on my part. I meant drupal_add_css and drupal_add_js

dvessel’s picture

Status: Active » Postponed (maintainer needs more info)

Add to where? Most js is added to the header and css has no business being added that late. By the time hook_footer is run, it's too late. Could you give a specific example?

starbow’s picture

Like I said, this could just be a documentation issue, but in Drupal 5 you can put those drupal_add_* calls into hook_footer and they will work fine.

dvessel’s picture

Project: Drupal core » Documentation
Version: 6.x-dev »
Component: base system » Developer Guide
Status: Postponed (maintainer needs more info) » Active

Looks like it is. The order it's called has been changed. Makes more sense in 6.

http://api.drupal.org/api/function/phptemplate_page/5
http://api.drupal.org/api/function/template_preprocess_page/6

hook_footer is invoked from theme_closure.

Barry Madore’s picture

Component: Developer Guide » Correction/Clarification

Changing component

Wolfflow’s picture

FYI: this is only an example of drupal_add_js: tested and works on drupal 5

Use Drupal JS Libraries : Your own collapsible fieldset

might help. Kind Regards

Wolfflow’s picture

Status: Active » Needs review

Mark this code needs review by Author

MGParisi’s picture

Status: Needs review » Fixed

comment says it works... Fixed

jhodgdon’s picture

Status: Fixed » Active

It seems to me that this is still a doc issue: a note needs to be added somewhere that when updating themes from D5 to D6, you cannot call drupal_add_css() in the footer any more and expect it to work. It looks like drupal_add_js in the footer might still work.

The comment above only says that *get* works in the footer, not *add*.

MGParisi’s picture

Instead of changing status and suggesting how things should be fixed, why don't you fix them? As for me... I am done working on the issue queue for documentation. I don't need this... This issue is a year old, and once again someone puts it off to sink to the bottom of the issue queue, where I fished it out from!

add1sun’s picture

@MGParisi, please don't take issue status changes as personal. If someone notices that something needs to be fixed, then we need to have an open issue and continue working on it. Just because someone notes an issues, doesn't mean that can fix it themselves or right away - or sometimes they want more confirmation before proceeding.

I understand the drive to close issues, but they do serve an important purpose and just because an issue is old doesn't mean that it isn't still a valid problem we need to address.

jhodgdon’s picture

Status: Active » Fixed

This has now been fixed -- I realized it was a module development issue, not a theme development issue. It's now added to http://drupal.org/node/114774 (5.x to 6.x module migration guide).

Status: Fixed » Closed (fixed)

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