【发布时间】:2016-01-06 08:20:41
【问题描述】:
我是 Drupal 7 的新手,在这个论坛上,请善待 :)
我正在尝试自定义一些“在网络上”的 drupal 模块(显示 facebook 和 youtube 链接按钮)。这个模块很好用,但我想修改这个模块提供的社交图像在 Zen 的子主题中的位置。我可以把它放在标题区域的左上角。 正如它在文档中所说的那样:
1)
将以下代码放在您主题的 template.php 文件中,并将“mytheme”替换为您的主题名称:
/**
* Overrides theme_on_the_web_image().
*/
function mytheme_on_the_web_image($variables) {
return $variables['service'];
}
2) 我在 page.tpl.php 中添加这一行:<div id="myidtomodifythecssafter"> <?php print $service; ?></div>,如下所示:
<?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) 我清除了缓存
然后模块图像没有出现,我在首页收到此错误:
注意:未定义变量:include() 中的服务
我不明白,我错过了什么?
【问题讨论】:
-
在 template.php 中,您是否在 theme_hook 函数中将 mytheme 替换为您的主题名称,因为您显示的代码没有?并且错误消息指向这个想法,即变量未定义,即您的主题看不到您的 theme_on_the_web_image 函数。
-
嗨 Laurent,是的,我做到了:所以现在是 -> function zhongdao_on_the_web_image($variables) {
标签: css module drupal-7 position