Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6970513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:43:09+00:00 2026-05-27T16:43:09+00:00

I am working on a drupal 7 site and am very new to this.

  • 0

I am working on a drupal 7 site and am very new to this. I need to create a totally separate home page from the rest of the site. I notice the head is built in the html.tpl.php file where all the scripts are loaded. I would rather not load scripts to the rest of the site that will only be used on the front page. Also I have found that drupal adds some code to the end of my script rendering it useless.

/js/image_scale.js?lwhgie”

What is going on here and how do get better control of this?
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:43:10+00:00Added an answer on May 27, 2026 at 4:43 pm

    Just to add a couple of points:

    If you want to aggregate your homepage JS (which you may or may not) then you shouldn’t add the stylesheets manually to the template file. You can add them in hook_preprocess_page(), something like this:

    /**
     * Implements hook_preprocess_page().
     */
    function MYMODULE_preprocess_page(&$vars) {
      if ($vars['is_front']) {
        $path = drupal_get_path('module', 'MYMODULE');
        drupal_add_js($path . '/MYMODULE1.js');
        drupal_add_js($path . '/MYMODULE2.js');
        $vars['scripts'] = drupal_get_js();
      }
    }
    

    Also I have found that drupal adds some code to the end of my script rendering it useless.

    /js/image_scale.js?lwhgie”

    That shouldn’t render your script useless. From the comments in drupal_get_js():

    A dummy query-string is added to filenames, to gain control over
    browser-caching. The string changes on every update or full cache
    flush, forcing browsers to load a new copy of the files, as the
    URL changed. Files that should not be cached (see drupal_add_js())
    get time() as query-string instead, to enforce reload on every
    page request.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on a Drupal site (I'm fairly new to Drupal) and need
We're building a very content rich site in Drupal. It's my first time working
I'm using the script from this site to migrate a Drupal database to WordPress.
I'm working on a Drupal 7 site. it is a redesign from Codeigniter and
I am working on a Drupal based site and notice there are a lot
I am working on a Drupal site that needs to have a 'careers' page.
i'm working on drupal community site and i want to ask about this things
I'm working on a Drupal mobile site which is powered by the Mobile module.
I have Drupal 7 site which is working fine. I added a custom PHP
I'm working on a Drupal 5.x book-selling site and using the Views Fast Search

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.