Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A lot of suggestions here work if you want your alteration to be theme-based, but if you want this to come from a module, using a block region, page template or page prepocess won't cut it, because <strong>you're tying the alteration to the theme.</strong></p> <p>From a modular standpoint, the following options are best:</p> <p><strong>hook_footer()</strong> -- <a href="http://api.drupal.org/api/function/hook_footer/6" rel="noreferrer">http://api.drupal.org/api/function/hook_footer/6</a> :: my_module_footer() should return a string of HTML, which can even be javascript. E.g. </p> <pre><code>function my_module_footer(){ return "&lt;script type='text/javascript'&gt;//your script&lt;/script&gt;" } </code></pre> <p>You can use drupal $_GET['q'] to get the page URL and have that return be conditional for the page URL. </p> <p>Otherwise, I sometimes use $GLOBALS["_add_my_footer"] as a boolean, and set it at various points in the module, then in hook_footer(), see if it is true.</p> <hr> <p><strong>drupal_add_js</strong> -- api.drupal.org/api/drupal/includes--common.inc/function/drupal_add_js/6 :: You can use this to add javascript to the footer by setting the $scope parameter to "footer" -- e.g. </p> <pre><code>function my_module_init(){ $script = "your script "; // notice no &lt;script&gt; tags drupal_add_js($script, 'inline', 'footer'); // you can also use this function to grab a .js file } </code></pre> <hr> <p>Note that I put that drupal_add_js into hook_init() -- I did that because if you don't, the script could get lost when using Drupal's aggressive caching feature.</p> <p>Unfortunately, there is no $scope parameter for drupal_add_css</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload