简体   繁体   English

Drupal7修改的用户登录没有效果吗?

[英]Drupal7 modified user login no effect?

I am new to Drupal. 我是Drupal的新手。 I am trying to create a modified login page. 我正在尝试创建修改后的登录页面。

I have modified the template.php of my theme with the name "cmse" in /sites/all/themes/cmse/ 我已经在/ sites / all / themes / cmse /中将主题的template.php修改为“ cmse”

This is my template.php: 这是我的template.php:

<?php
function cmse_preprocess_html(&$vars) {
  $vars['classes_array'][] = 'homepage';
  $vars['classes_array'][] = 'teaser';
}
function cmse_theme() {
  $items = array();
  // create custom user-login.tpl.php
  $items['user_login'] = array(
  'render element' => 'form',
  'path' => drupal_get_path('theme', 'cmse') . '/templates',
  'template' => 'user-login',
  'preprocess functions' => array(
  'cmse_preprocess_user_login'
  ),
 );
return $items;
}

This is the new file "user_login.tpl.php" in /sites/all/themes/cmse/templates 这是/ sites / all / themes / cmse / templates中的新文件“ user_login.tpl.php”

<?php
    // split the username and password so we can put the form links were we want (they are in the "user-login-links" div bellow)
    print drupal_render($form['name']);
    print drupal_render($form['pass']);
    ?>
    <div class="user-login-links">
    <span class="password-link"><a href="/user/password">Forget your password?</a></span> | <span class="register-link"><a href="/user/register">Create an account</a></span>
    </div>


    <?php
        // render login button
    print drupal_render($form['form_build_id']);
    print drupal_render($form['form_id']);
    print drupal_render($form['actions']);
    ?>

All changes doesn't have any effect to my login page. 所有更改对我的登录页面没有任何影响。 Any ideas what's wrong? 任何想法有什么问题吗?

Thanks in advance 提前致谢

There could be a number of reasons. 可能有多种原因。

Drupal cache is very notorious so ensure to clear cache. Drupal缓存非常臭名昭著,因此请确保清除缓存。 You can do that via instructions here 您可以通过此处的说明进行操作

Clearing the cache The easiest way to clear the Drupal cache is to go to Administration > Configuration > Development > Performance ( http://example.com/admin/config/development/performance ) Click the button "Clear all caches" 清除缓存清除Drupal缓存的最简单方法是转到管理>配置>开发>性能( http://example.com/admin/config/development/performance )单击“清除所有缓存”按钮

Have you selected your new theme instead of existing one? 您是否选择了新主题而不是现有主题? Follow Instructions here on how to select a new theme. 按照此处的指示信息选择新主题。

Further just replacing values to the new theme name cmse may not work. 此外,仅将值替换为新主题名称cmse可能不起作用。 The right way to do this would be to add a custom module and then call the .tpl.php file from there. 正确的方法是添加一个自定义模块,然后从那里调用.tpl.php文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM