我發現了很多有關如何在D6上執行此操作的教程,但是,似乎我發現的示例代碼在歐米茄子主題上並不完美。Drupal 6中的主題用戶註冊頁面,帶有Omega子主題
Here's代碼從來就發現它很適合我最好的(via Trellon):
內template.tpl.php:
<?php
function themename_theme($existing, $type, $theme, $path) {
return array(
...
// tell Drupal what template to use for the user register form
'user_register' => array(
'arguments' => array('form' => NULL),
'template' => 'user-register', // this is the name of the template
),
...
);
}
?>
而且here's用戶register.tpl。 PHP的形式:
<div id="registration_form">
<div class="field">
<?php
print drupal_render($form['account']['name']); // prints the username field
?>
</div>
<div class="field">
<?php
print drupal_render($form['account']['pass']); // print the password field
?>
</div>
<div class="field">
<?php
print drupal_render($form['submit']); // print the submit button
?>
</div>
</div>
</div>
的事情是,我template.tpl.php文件裏從來就已經宣佈mytheme_theme,所以我不知道如何添加新的代碼。
裏面我的歐米茄次主題文件夾:
/**
* Implementation of HOOK_theme().
*/
function lcph_theme(&$existing, $type, $theme, $path) {
$hooks = omega_theme($existing, $type, $theme, $path);
// Add your theme hooks like this:
/*
$hooks['hook_name_here'] = array(// Details go here);
*/
// @TODO: Needs detailed comments. Patches welcome!
return $hooks;
}
事實上,如果我只是複製/粘貼我的模板文件中的代碼,這是從來就得到了錯誤:
Fatal error: Cannot redeclare lcph_theme() (previously declared in /sites/all/themes/lcph/template.php:22) in /sites/all/themes/lcph/template.php on line 125
如何我可以在我的omega subtheme模板中添加示例代碼嗎? 感謝您的指導和幫助!
Rosamunda