Drupal 自适应主题徽标 url 链接到外部站点
我有使用自适应主题的 drupal 网站。现在徽标中的链接指向“/”(指向我网站的根目录),但我想更改它,以便它直接指向外部网站(www.domain.com)。我该怎么做?
这是在 template.preprocess-page.inc 中创建徽标图像的位置,但我不知道徽标的 URL 在哪里。任何建议将不胜感激!
$vars['logo_alt_text'] = check_plain(variable_get('site_name', '')) .' '. t('logo');
$vars['logo_img'] = $vars['logo'] ? '<img src="'. check_url($vars['logo']) .'" alt="'. $vars['logo_alt_text'] .'" title="'. t('Home page') .'"/>' : '';
$vars['linked_site_logo'] = $vars['logo_img'] ? l($vars['logo_img'], '<front>', array('attributes' => array('rel' => 'home'), 'title' => t('Home page'), 'html' => TRUE)) : '';
$vars['linked_site_name'] = $vars['site_name'] ? l($vars['site_name'], '<front>', array('attributes' => array('rel' => 'home'), 'title' => t('Home page'))) : '';
I have drupal site that uses the adaptive theme. Now the link in the logo is directed to "/" (to root of my site) but I would like to change it so that it would dirent to outside site (www.domain.com). How can I do this?
This where the logo image is created in template.preprocess-page.inc but I have no clue where the URL gets to the logo. Any advie would be apprerciated!
$vars['logo_alt_text'] = check_plain(variable_get('site_name', '')) .' '. t('logo');
$vars['logo_img'] = $vars['logo'] ? '<img src="'. check_url($vars['logo']) .'" alt="'. $vars['logo_alt_text'] .'" title="'. t('Home page') .'"/>' : '';
$vars['linked_site_logo'] = $vars['logo_img'] ? l($vars['logo_img'], '<front>', array('attributes' => array('rel' => 'home'), 'title' => t('Home page'), 'html' => TRUE)) : '';
$vars['linked_site_name'] = $vars['site_name'] ? l($vars['site_name'], '<front>', array('attributes' => array('rel' => 'home'), 'title' => t('Home page'))) : '';
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此行将徽标设置为 img 链接:
其中
$vars['logo_img']
为图像,
为链接的 url。l()
是 Drupal 中内置的函数。 关于l() 的文档
此外,您可能希望阅读有关预处理函数的更多信息:设置在模板中使用的变量(预处理和处理函数)
This line sets the logo as a img link:
With
$vars['logo_img']
being the image, and<front>
being the url for the link.l()
is a function built into Drupal. Documentation onl()
Also you may wish to read more about preprocess functions: Setting up variables for use in a template (preprocess and process functions)
Drupal 6、7 和 Drupal 需要设置不同的文件。 8. 在 Drupal 9 及更高版本中也可能发生这种情况。
在 Drupal 6 上,将其设置在
template.preprocess-page.inc
中。在 Drupal 7 上,我们需要在
template.php
中设置它。在 Drupal 8 twig 中的变量
THEME.theme
。如果您的自定义徽标未显示,而您的 html 代码已在页面源中呈现,则您可能需要通过在主题设置中取消选中它来禁用主题徽标。
There are different file to be set for Drupal 6, 7 & 8. It may happen also in Drupal 9 and further.
On Drupal 6 set it in
template.preprocess-page.inc
.On Drupal 7 we need to set it in
template.php
.On Drupal 8 twig the vars in
THEME.theme
.If your custom logo is not shown while your html code is already rendered in the page source then you may need to disable the theme logo by uncheck it on your theme setting.