Horizontal Login
am 13.07.2011 - 22:23 Uhr in
Hallo zusammen,
ich versuche eine Horizontale Login Box zu realisieren.
Eingebaut habe ich (geklaut von http://www.drupalstore.info/blog/drupal-7-creating-horizontal-login-bar-...) :
template.php
<?php
function horizontal_login_block($form) {
$form['#action'] = url($_GET['q'], array('query' => drupal_get_destination()));
$form['#id'] = 'horizontal-login-block';
$form['#validate'] = user_login_default_validators();
$form['#submit'][] = 'user_login_submit';
$form['#prefix'] = '
';
$form['#suffix'] = '
';
$form['name'] = array(
'#type' => 'textfield',
'#prefix' => '
',
'#suffix' => '
',
'#maxlength' => USERNAME_MAX_LENGTH,
'#size' => 15,
'#required' => TRUE,
'#default_value' => 'Username',
'#attributes' => array('onblur' => "if (this.value == '') {this.value = 'Username';}", 'onfocus' => "if (this.value == 'Username') {this.value = '';}" ),
);
$form['pass'] = array(
'#type' => 'password',
'#maxlength' => 60,
'#size' => 15,
'#required' => TRUE,
'#prefix' => '
',
'#suffix' => '
',
);
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => '');
return $form;
}
?><?php
function login_bar() {
global $user;
if ($user->uid == 0) {
$form = drupal_get_form('horizontal_login_block');
return render($form);
} else {
// you can also integrate other module such as private message to show unread / read messages here
return '
' . t('Welcome back ') . ucwords($user->name) . '
';
}
}
?>in die CSS Datei habe ich eingefügt:
<?php
/** Login Bar **/
.usericon, .passicon {
float: left;
width: 180px;
padding-left: 36px; /** create space for small 24px x 24px icon **/
height: 24px;
}
#loginbar {width: auto; float: right;}
#loginbar .form-actions {display: none;}
#loginbar p { color: #fff; font-size: 1.1em; font-weight: bold;}
?>Das funktioniert so leider nicht - fehlt da nicht noch die Ausgabe in der page.tpl.php?....print...Login??
- Anmelden oder Registrieren um Kommentare zu schreiben

Mal ne blöde Frage? Hast du
am 15.07.2011 - 19:16 Uhr
Mal ne blöde Frage? Hast du den Cache geleert?
ja Cache ist leer - ich hab
am 15.07.2011 - 22:09 Uhr
ja Cache ist leer - ich hab auch leider immer noch keine Lösung wie ich das Script darstellen soll.
Olivier schrieb ich hab auch
am 16.07.2011 - 06:58 Uhr
ich hab auch leider immer noch keine Lösung wie ich das Script darstellen soll.
Den neuen Login kannst du an der gewünschten Stelle (beispielsweise in der page.tpl.php) mit
<?phpprint login_bar();
?>
Danke - Das wars! Viele
am 16.07.2011 - 20:14 Uhr
Danke - Das wars!
Viele Grüße
Olivier