Drupal自适应主题标志url链接到外部网站

时间:2011-06-29 15:10:29

标签: drupal drupal-themes

我有使用自适应主题的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'))) : '';

2 个答案:

答案 0 :(得分:2)

此行将徽标设置为img链接:

$vars['linked_site_logo'] = $vars['logo_img'] ? l($vars['logo_img'], '<front>', array('attributes' => array('rel' => 'home'), 'title' => t('Home page'), 'html' => TRUE)) : '';

$vars['logo_img']为图像,<front>为链接的网址。 l()是Drupal内置的函数。 Documentation on l()

您还可以阅读有关预处理功能的更多信息:Setting up variables for use in a template (preprocess and process functions)

答案 1 :(得分:0)

Drupal 6,7&amp;有不同的文件设置。 8.也可能在Drupal 9中进一步发生。

在Drupal 6上将其设置为template.preprocess-page.inc 在Drupal 7上,我们需要在template.php中设置它 在Drupal 8 twig THEME.theme中的变种。

如果您的html代码已在页面源中呈现时未显示自定义徽标,则可能需要在主题设置中取消选中该徽标,以禁用主题徽标。

相关问题