2013-03-18 16:27
浏览 29

在Drupal 7中创建自定义页面时出错

(Using Adaptive Theme) I want a new and custom user login page. So, put this code in my template.php:

function mythemename_theme() {
  $items = array();
  // create custom user-login.tpl.php
  $items['user_login'] = array(
  'render element' => 'form',
  'path' => drupal_get_path('theme', 'mythemename') . '/templates',
  'template' => 'user-login',
  'preprocess functions' => array(
return $items;

Changed mythemename to my custom theme name. And created user-login.tpl.php files and put this code:

  print drupal_render($form['name']);
  print drupal_render($form['pass']);
  print drupal_render($form['form_build_id']);
  print drupal_render($form['form_id']);
  print drupal_render($form['actions']);

Lastly, cleared my site cache. But when i click login page not changed.

Where the error am I doing? How can I solve this problem?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dozabt4329 2013-03-19 04:24

    Try putting this in template.php, change mythemename to theme name, and flush the cache.

    function mythemename_theme($existing, $type, $theme, $path){
        'render element'=>'form',
        return $hooks;

    Then in templates/user-login.tpl.php insert:

    print render($form['name']);
    print render($form['pass']);
    print render($form['form_build_id']);
    print render($form['form_id']);
    print render($form['actions']);


    <?php print drupal_render_children($form) ?>
    解决 无用
    打赏 举报

相关推荐 更多相似问题