从drupal 7中的后端界面将网站徽标链接到外部URL

时间:2013-05-08 13:32:41

标签: php drupal-7

需要在drupal 7中从后端界面将网站徽标链接到外部网址。

现在我将其硬编码到我的page.tpl.php文件中。

是否可以从后端添加它?

2 个答案:

答案 0 :(得分:0)

将网站徽标链接到外部网址没有默认选项。

我们需要在后端为主题设置创建一个字段。

  1. 使用以下代码

    在主题文件夹中创建一个页面theme-settings.php

    function theme_form_system_theme_settings_alter(& $ form,$ form_state){

    $ form ['theme_settings'] = array(

    '#type' => 'fieldset',
    
    '#title' => t('Theme settings')
    

    );

  2. $ form ['theme_settings'] ['theme_logourl'] = array(

        '#type'          => 'textfield',
    
        '#title'         => t('Logo url'),
    
        '#default_value' => theme_get_setting('theme_logourl'),
    
        '#description'   => t("Logo url for external linking"),
    
      );
      return $form;
    
    }
    
    1. 转到并查看主题设置页面 - 外观/设置/主题

      将提交一个新文本以输入外部网址

答案 1 :(得分:0)

对于Drupal 7,您可以参考 this discussion :在template.php文件中,将<front>更改为您喜欢的任何链接。 (是首页网址的Drupal快捷方式)