Hi everyone, i m new to Drupal 7 and in this forum, please be nice :)

I just wanted to modify the position of the social images provided by this module inside a sub theme of Zen. As it says in the documentation I :

1)

Place the following code in the template.php file in your theme, and replace 'mytheme' with the name of your theme:
/**
* Overrides theme_on_the_web_image().
*/
function mytheme_on_the_web_image($variables) {
return $variables['service'];
}

2) I add this line : <div id="myidtomodifythecssafter"> <?php print $service; ?></div> in the page.tpl.php like following :

<?php if ($site_name || $site_slogan): ?>
      <div id="name-and-slogan">
      <div id="myidtomodifythecssafter"> <?php print $service; ?></div>
        <?php if ($site_name): ?>
          <?php if ($title): ?>
            <div id="site-name"><strong>
              <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
            </strong></div>
          <?php else: /* Use h1 when the content title is empty */ ?>
            <h1 id="site-name">
              <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
            </h1>
          <?php endif; ?>
        <?php endif; ?>

        <?php if ($site_slogan): ?>
          <div id="site-slogan"><?php print $site_slogan; ?></div>
        <?php endif; ?>
      </div><!-- /#name-and-slogan -->
    <?php endif; ?>

3) I clear the cache

but then the images don't appear and i got this error in the front page : Notice: Undefined variable: service in include()
i don't understand, what did I miss ?

Comments

maatthieu created an issue. See original summary.

jenlampton’s picture

Status: Active » Fixed

Hello @maatthieu, and thanks for the question.

I just wanted to modify the position of the social images provided by this module inside a sub theme of Zen.

The code that you cited as an example mytheme_on_the_web_image has nothing to do with modifying the position of the social images inside a sub theme of zen. That would allow you to replace the <img> tags provided by this module.

I add this line : <div id="myidtomodifythecssafter"> <?php print $service; ?></div> in the page.tpl.php

This would affect your zen sub-theme, but you'll need to first define the $service variable, or you'll get the error you reported. Why not set that to on_the_web_display_block(0), or better yet, just put that in your page template, like so:

<div id="myidtomodifythecssafter"> <?php print on_the_web_display_block(0); ?></div>

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.