Skip to main content
Tweeted twitter.com/#!/StackDrupal/status/407228118391619586
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Source Link
MyPalDrupal
  • 280
  • 1
  • 11

Fixing Notice: Undefined variable: content_share in include() (line 39....node.tpl.php)?

I followed online tutorials and defined a new region in litejazz Drupal 7 theme info file as :

regions[content_share] = Content Bottom

and exposed the new block using the code below in node.tpl.php as :

<div class="clearfix clear"></div>
  <?php if (!empty($content['links']['node']['#links']) || !empty($content['links']['comment']['#links']) || !empty($content['links']['blog']['#links'])): ?>
    <div class="links">&raquo; <?php print render($content['links']); ?></div>
  <?php endif; ?>
      <?php if ($content_share): ?> //<<<<<<<<<<<- THIS LINE CAUSES WARNING
  <div>
    <?php print render($content_share); ?>
  </div>
<?php endif; ?>
  <?php if ($content['comments'] && ($page)) { ?>
    <?php print render($content['comments']); ?>
  <?php }; ?>

Now my logs are getting filled with following warning :

Notice: Undefined variable: content_share in include() (line 39 of /srv/bindings/ertr88c9reretrea25f7b405eeee/code/sites/all/themes/litejazz/templates/node.tpl.php).

I had tried clearing cache as suggested in other solutions but none worked.