Theme user registration page in Drupal 6 with an Omega subtheme
I´ve found numerous tutorials on how to do this on D6, BUT, it seems that the example code I´ve found doesn´t quite work on Omega subtheme.
Here´s the code I´ve found it suits me best (via Trellon):
Inside 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
),
...
);
}
?>
And here´s the user-register.tpl.php form:
<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>
The thing is that inside my template.tpl.php file I´ve already declared mytheme_theme, so I don´t know how to add the new code.
Inside My omega subtheme folder:
/**
* 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;
}
In fact, if I just copy/paste the code inside my template file, this is the error I´ve got:
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开发者_JS百科
How could I add the example code inside my omega subtheme template? Thanks for your guidance and help!
Rosamunda
dont add any thing to template.php file unless you search in your template.php file for omega_theme() function if you found it then modify it...if you didn't find it then create ur own one...... i dont understand u exactly but maybe the following steps may help you
1- search for your template.php file * if you didn't find it then create ur own one in your theme folder 2- search for urthemename_theme() function in your template.php file * if you found it then you can modify it... if you don't you can create ur own function as the following
function omega_theme($existing, $type, $theme, $path) {
return array(
'user_register' => array(
'arguments' => array('form' => NULL),
'template' => 'user-register', // this is the name of the template
),
);
}
3- search for user_register.tpl.php file in ur theme files...if u didn't find it then create your own one and put the following code inside it
<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>
i dont know what you mean by template.tpl.php file...i think you mean template.php i hope that help you
精彩评论