1

I am newbie and using Drupal - 7.

I have added script tags into my customized html.tpl file.

<script async src="http://i.simpli.fi/dpx.js?cid=0&segment=Segment+Name&campaign_id=0"></script> 

And now I am getting this "--> ;" into front page of my website.

This is the code for my customized html.tpl. file with script tags.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
  "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" version="XHTML+RDFa 1.0" dir="<?php print $language->dir; ?>"<?php print $rdf_namespaces; ?>>
<head profile="<?php print $grddl_profile; ?>">
  <?php print $head; ?>
  <title><?php print $head_title; ?></title>
  <?php print $styles; ?>
 <!-- <?php print $scripts; ?> --> 
</head>
<body<?php print $attributes;?>>
<?php print $scripts; ?>
<script async src="http://i.simpli.fi/dpx.js?cid=0&segment=Segment+Name&campaign_id=0"></script> 
  <div id="skip-link">
    <a href="#main-content" class="element-invisible element-focusable"><?php print t('Skip to main content'); ?></a>
  </div>
  <?php print $page_top; ?>
  <?php print $page; ?>
  <?php print $page_bottom; ?>
</body>
</html>

Can anyone please help me?

Thanks!

closed as off-topic by kiamlaluno May 6 '15 at 5:52

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on programming, PHP, SQL, etc. that do not relate directly to Drupal are off-topic here, but can be asked on Stack Overflow." – kiamlaluno
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome to Drupal Answers. This is not a Drupal question, since you would get the same with plain PHP, or WordPress. – kiamlaluno May 6 '15 at 5:54
  • @kiamlaluno: This error occurs in template file due to php code. And html.tpl.php file is in Drupal and this type of question/answer is very helpful to newbie like me. – Vidushi May 6 '15 at 13:28
  • Yes, but the PHP in a template file is not different from the PHP you could write without using Drupal. PHP syntax doesn't change, and a PHP comment is not different, if you are using Drupal, WordPress, or plain PHP. – kiamlaluno May 6 '15 at 13:38
  • Yes this thing is right from experienced person but from newbie perspective, when you are new to drupal, sometimes you may not realize that this is just php code which gives an error. You always start thinking that may be something breaks in drupal code or may be I edited wrong file in drupal which gives an error. – Vidushi May 6 '15 at 14:03
  • The question doesn't require any Drupal knowledge; I just need to know PHP basics, to answer it. If a question doesn't require Drupal expertise to answer it, then it is not about Drupal, and it is off-topic here. It's not that, since you are using Drupal, then it is a Drupal question. It is a Drupal question if only the users who know Drupal can answer it. – kiamlaluno May 6 '15 at 14:42
4

I guess your problem comes from this line :

   <!-- <?php print $scripts; ?> -->

Don't comment things this way. Rather do :

  <?php /* print $scripts; */ ?>

Or even better just delete the line if not needed.

I hope that helps.

  • Yes, the commented out line could simply be removed, since there is another line outputting the same. – kiamlaluno May 6 '15 at 5:56
5

it is probably stemming from this line:

<!-- <?php print $scripts; ?> --> 

<!-- --> is a commenting system for HTML, but the item you are trying to comment out is php, which uses a different method for commenting.

you would use the html commenting around html elements:

<!-- <div>Hello World!</div> -->

whereas for php:

<?php //print $scripts; ?>

or

<?php /*print $scripts;*/ ?>

would be appropriate.

  • Thanks @rtome and @ Geoff. I have deleted that comment line and error "--> ;" goes away. Thank you so much. – Vidushi May 5 '15 at 16:02

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