Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem with swfobject_api or jwplayer module.

When I use this code in node.tpl.php everything is fine.

$flashVars=array( 'file' => 'path to flv' );
print theme('jwplayermodule_render_player', $config, $flashVars);

When I use this code in front-page.tpl.php the code is not working.

In node-tpl.php this JavaScript is added.

<script type="text/javascript" src="/projects/theme/sites/all/modules/drupal/jwplayermodule/jwplayermodule_jwembedder.js?c"></script>
<script type="text/javascript">
jQuery.extend(Drupal.settings, { "jwplayer": { "files": { "jwplayer-1": { "flashplayer": "http://localhost/projects/theme/sites/default/files/jwplayermodule/player/player.swf", "width": "400", "height": "280", "controlbar": "bottom", "wmode": "opaque", "file": "/projects/theme/sites/default/files/1057680_0.flv", "config": "http://localhost/projects/theme/sites/default/files/jwplayermodule/configs/sample.xml", "events": [  ] } } } });

In front-page.tpl.php, it is not added.

I put <?php print $closure ?> in footer.php, and included it in front-page.tpl.php and node.tpl.php.

share|improve this question
what is output for front-page.tpl.php? nothing? if nothing are you sure front-page.tpl.php registered correctly? – Mohammad Ali Akbari Sep 3 '11 at 20:38

Your template file should be called page-front.tpl.php, not front-page.tpl.php. Once you've renamed it flush your caches and it will work!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.