Passing variables to JS from theme folder .tpl files I use many template files in my modules via hook theme. In order to pass variable to JS files I use the method described here:
https://www.drupal.org/node/304258
in the .tpl.php files:

$my_settings = array(
  'basePath' =&gt; $base_path,
  'animationEffect' =&gt; variable_get('effect', 'none')
);

drupal_add_js(array('myModule' =&gt; $my_settings), 'setting');


and then in the .js files:

var basePath = Drupal.settings.myModule.basePath;
var effect = Drupal.settings.myModule.animationEffect;


For the first time (it seems) I'm trying to pass variables to JS from .tpl files located in my theme folder.
Suppose I have a content type called 'cars',  I craete a page-cars.tpl.php template file in my theme folder which automatically applies to all car pages. But in these tpl files I can't pass variables to JS using the method described above.
I tried switching 'myModule' to 'myTheme' but Drupal won't recognize it as a defined setting

As per Clive's instructions I added to the my_theme_preprocess_content_type(&amp;$variables) function and it works! (thanks Clive)
Take a look at the variable_set function. If my memory is correct, I used this to move variables between PHP and java script.