dongnan1899 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(
  'mythemename_preprocess_user_login'
  ),
 );
return $items;
}

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

<?php 
  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 mysite.com/user 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){
        $hooks['user_login']=array(
        'render element'=>'form',
        'template'=>'templates/user-login',
        );
        return $hooks;
    }
    

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

    <?php
    print render($form['name']);
    print render($form['pass']);
    print render($form['form_build_id']);
    print render($form['form_id']);
    print render($form['actions']);
    ?>
    

    or

    <?php print drupal_render_children($form) ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题