HTML code to PHP code mapping does not work I am trying to include the timeline API, and install the timline files on my webserver. The timeline-api.js gives an example of an HTML page that contain the following code. 

&lt;script&gt;
var Timeline_ajax_url="http://YOUR_SERVER/apis/timeline/ajax/simile-ajax-api.js";
var Timeline_urlPrefix='http://YOUR_SERVER/apis/timeline/';       
&lt;/script&gt;
&lt;script src="http://YOUR_SERVER/javascripts/timeline/timeline-api.js"    
type="text/javascript"&gt;
&lt;/script&gt;


It also contain the following comment.

   /*
    * Eg the two next lines pass the same parameters:
    * Timeline_parameters='bundle=true';                    // pass parameter via js variable
    * &lt;script src="http://....timeline-api.js?bundle=true"  // pass parameter via url 
    */


I am trying to do the same thing in Drupal using the following code.

$timeline_lib_path = $base_path . libraries_get_path('simile_timeline');
// Set some global js variables that the library is going to need for proper inclusion and functionality.
$timeline_inline_js = "
var Timeline_ajax_url = '$timeline_lib_path/timeline_ajax/simile-ajax-api.js',
Timeline_urlPrefix = '$timeline_lib_path/timeline_js/',
Timeline_parameters = 'bundle=true';
";
drupal_add_js('similetimeline',$timeline_inline_js);
drupal_add_js('similetimeline','$timeline_lib_path/timeline_js/timeline-api.js');


I have an uncaught reference error: Timeline is not defined.
You have the smallest of errors in your code; in the very last line you're trying to interpolate a variable into a string using single quotes. You need to use double quotes instead:

drupal_add_js('similetimeline',"$timeline_lib_path/timeline_js/timeline-api.js");


Have a peek at the PHP Strings Documentation for more information.

I've just noticed another problem actually; you don't seem to be using drupal_add_js() properly. The first argument should be the name of a file or an inline string, in which case you should specify that it's inline:

drupal_add_js($timeline_inline_js, 'inline');
drupal_add_js("$timeline_lib_path/timeline_js/timeline-api.js");