derekshull Posted October 16, 2012 Share Posted October 16, 2012 (edited) I have this code: <?php // template.php code 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' => 'Login'); return $form; } ?> Right now the Username and Password and Login button are vertical but I want to make them horizontal. Any idea how to accomplish this? I have this calling it to the page: <?php print login_bar(); function login_bar() { global $user; if ($user->uid == 0) { $form = drupal_get_form('horizontal_login_block'); // Drupal 7 uses a new function 'render'. return render($form); } else { return t('Welcome back ') . ucwords($user->name); } } ?> Edited October 16, 2012 by derekshull Quote Link to comment https://forums.phpfreaks.com/topic/269544-help-with-making-login-horizontal/ Share on other sites More sharing options...
Christian F. Posted October 16, 2012 Share Posted October 16, 2012 This seems to be third party framework functions, specifically Drupal 7. Which means you've posted in the wrong section, and that you should have made a mention of this from the start, instead of me having to guess so on the basis of a comment in the code. Quote Link to comment https://forums.phpfreaks.com/topic/269544-help-with-making-login-horizontal/#findComment-1385667 Share on other sites More sharing options...
derekshull Posted October 16, 2012 Author Share Posted October 16, 2012 You are correct I aplogize. Quote Link to comment https://forums.phpfreaks.com/topic/269544-help-with-making-login-horizontal/#findComment-1385669 Share on other sites More sharing options...
derekshull Posted October 16, 2012 Author Share Posted October 16, 2012 I figured it out though. Quote Link to comment https://forums.phpfreaks.com/topic/269544-help-with-making-login-horizontal/#findComment-1385670 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.