adding javascript to tpl file from template.php &lt;?php
drupal_add_js(drupal_get_path('theme', 'mytheme') .'/my_js_file.js', 'theme');
?&gt;


I want to add a javascript file just to the tpl file titled 

views-view--gurus--page-1.tpl.php


I have this code to enter it to a specific them but what about just a certain tpl file.

I am guessing something like this

drupal_add_js(drupal_get_path('theme', 'mytheme') .'/my_js_file.js', 'view');
This is what I'm using. I don't know if this will have any gotchas in future where the template file I want is in the array but not actually used. So far it's working flawlessly.

function yourthemename_preprocess_page(&amp;$vars) {
    $templates = $vars['template_files'];
    if (in_array('page-node-add-discipline', $templates)) {
        drupal_add_js(path_to_theme() . '/js/create_discipline.js');
        $vars['scripts'] = drupal_get_js();
    }
}


Put that in your template.php