Skip to main content
added 75 characters in body
Source Link
arkchong
  • 221
  • 2
  • 3
  • 6

I would like to know what is the best way to add a JavaScript file into a specific page basing on the content type. For example, I want to add this:

<script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=false'></script>

So far, what I have done is using this way to add into my specific content type. For the map_page content type, I adde the below two line of code in page--map_page.tpl.php.

drupal_add_js("http://maps.google.com/maps/api/js?sensor=false", 'external');
$scripts = drupal_get_js();

Is there any other better way? if possible can give some example, currently not really understand well...

I would like to know what is the best way to add a JavaScript file into a specific page basing on the content type. For example, I want to add this:

<script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=false'></script>

So far, what I have done is using this way to add into my specific content type. For the map_page content type, I adde the below two line of code in page--map_page.tpl.php.

drupal_add_js("http://maps.google.com/maps/api/js?sensor=false", 'external');
$scripts = drupal_get_js();

Is there any other better way?

I would like to know what is the best way to add a JavaScript file into a specific page basing on the content type. For example, I want to add this:

<script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=false'></script>

So far, what I have done is using this way to add into my specific content type. For the map_page content type, I adde the below two line of code in page--map_page.tpl.php.

drupal_add_js("http://maps.google.com/maps/api/js?sensor=false", 'external');
$scripts = drupal_get_js();

Is there any other better way? if possible can give some example, currently not really understand well...

Tweeted twitter.com/#!/StackDrupal/status/68060658582827008
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
deleted 53 characters in body; edited title
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Add JSJavaScript into Specific Content Type in Drupal 7?a specific content type

I would like to know what is the best way to add a JSJavaScript file into specifya specific page basebasing on the content type, for. For example, I want to add this:

<script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=false'></script>

So far, what I have done is using this way to add into my specific content type, for example it is a. For the map_page content type call map_page (page, I adde the below two line of code in page--map_page.tpl.php). And below two line of code is added in this map_page content type.

drupal_add_js("http://maps.google.com/maps/api/js?sensor=false", 'external');
$scripts = drupal_get_js();

Is there any other better way?

Thank in advance.

Add JS into Specific Content Type in Drupal 7?

I would like to know what is the best way to add a JS into specify page base on the content type, for example I want to add this:

<script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=false'></script>

So far what I have done is using this way to add into my specific content type, for example it is a content type call map_page (page--map_page.tpl.php). And below two line of code is added in this map_page content type.

drupal_add_js("http://maps.google.com/maps/api/js?sensor=false", 'external');
$scripts = drupal_get_js();

Is there any other better way?

Thank in advance.

Add JavaScript into a specific content type

I would like to know what is the best way to add a JavaScript file into a specific page basing on the content type. For example, I want to add this:

<script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=false'></script>

So far, what I have done is using this way to add into my specific content type. For the map_page content type, I adde the below two line of code in page--map_page.tpl.php.

drupal_add_js("http://maps.google.com/maps/api/js?sensor=false", 'external');
$scripts = drupal_get_js();

Is there any other better way?

Source Link
arkchong
  • 221
  • 2
  • 3
  • 6
Loading