2012-10-10 147 views

回答

3

Drupal的開箱即不提供登記表格任何模板建議。你需要編寫一個自定義模塊來添加它。你可以做這樣的事情:

/** 
* Implements hook_theme(). 
*/ 
function mymodule_theme() { 
    $items = array(
    'user_register_form' => array(
     'render element' => 'form', 
     'template' => 'templates/user-register-form', 
    ), 
); 
    return $items; 
} 

然後你不得不在MyModule的模板/模板稱爲用戶寄存器form.tpl.php您可以自定義或在您的主題覆蓋。

+0

我在Drupal 7嘗試這樣做,也沒有工作。不知道爲什麼...... –

4

您想使用page--user--register.tpl.php而不是page--user-register.tpl.php

page--user-register.tpl.php更改頁面模板user-register,而page--user--register.tpl.php更改頁面user/register的模板。

0

另一種方式將使用「面板」創建custon註冊頁面:

  1. 安裝並啓用面板模塊
  2. 創建新頁面「註冊頁面」,並設計佈局
  3. 內容添加到您的區域。對於你的情況下,「登記塊」或「登錄塊」
1

的Drupal 7

此代碼添加到您的template.php在你的主題目錄。

function yourtheme_theme() { 
     return array(
     'user_login' => array(
      'template' => 'user-login', 
      'arguments' => array('form' => NULL), 
     ), 
    ); 
    } 

    function yourtheme_theme() { 
     $items = array(); 
     $items['user_login'] = array(
     'render element' => 'form', 
     'path' => drupal_get_path('theme', 'yourtheme') . '/templates', 
     'template' => 'user-login', 
     'preprocess functions' => array(
      'yourtheme_preprocess_user_login' 
     ), 
    ); 
     return $items; 
    } 

    function yourtheme_preprocess_user_login(&$vars) { 
     $vars['intro_text'] = t('This is my awesome login form'); 
    } 

在名爲user-login.tpl.php的主題「模板」文件夾中創建一個文件。

添加此代碼並將「yourtheme」更改爲您的主題名稱。

<?php print drupal_render_children($form) ?> 

清除緩存。

源(在這裏您可以找到關於如何做到這一點的用戶註冊表單,用戶密碼的形式,和Drupal 6的細節) https://drupal.org/node/350634