Jump to content

ankh2054

Members
  • Posts

    85
  • Joined

  • Last visited

Everything posted by ankh2054

  1. Hi All, I have followed a tutorial on firms to start building my user registration form. It works great thanks Soma. What I am struggling with is the CSS around the form. What I would lie to do is build the form myself in HTML, is this achievable? My register.php is below, but instead of just outputting the form using <? echo $out; ?>. I would like to build the form myself so I can use twitter bootstrap as the base CSS.: <?php $out = ''; // create a new form field (also field wrapper) $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'subscribe-form'); // create a text input $field = $modules->get("InputfieldText"); $field->label = "Name"; $field->attr('id+name','name'); $field->required = 1; $form->append($field); // append the field to the form // create email field $field = $modules->get("InputfieldEmail"); $field->label = "E-Mail"; $field->attr('id+name','email'); $field->required = 1; $form->append($field); // append the field // you get the idea $field = $modules->get("InputfieldPassword"); $field->label = "Passwort"; $field->attr("id+name","pass"); $field->required = 1; $form->append($field); // oh a submit button! $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Subscribe"); $submit->attr("id+name","submit"); $form->append($submit); // form was submitted so we process the form if($input->post->submit) { // user submitted the form, process it and check for errors $form->processInput($input->post); // here is a good point for extra/custom validation and manipulate fields $email = $form->get("email"); if($email && (strpos($email->value,'@hotmail') !== FALSE)){ // attach an error to the field // and it will get displayed along the field $email->error("Sorry we don't accept hotmail addresses for now."); } if($form->getErrors()) { // the form is processed and populated // but contains errors $out .= $form->render(); } else { // do with the form what you like, create and save it as page // or send emails. to get the values you can use // $email = $form->get("email")->value; // $name = $form->get("name")->value; // $pass = $form->get("pass")->value; // // to sanitize input // $name = $sanitizer->text($input->post->name); // $email = $sanitizer->email($form->get("email")->value); $out .= "<p>You submission was completed! Thanks for your time."; } } else { // render out form without processing $out .= $form->render(); } ?> <?php include("./head.inc"); ?> <body> <?php include("./navbar.inc"); ?> <div class="container"> <div class="row"> <? echo $out; ?> </div> <?php include ("./foot.inc"); ?> </div> <?php include ("./java.inc"); ?>
  2. haha yes indeed, don't have those pages ready
  3. thanks that worked Just leaving my code, for other people who might struggle like me <?php if($user->isLoggedin()): ?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo $user->name; ?><b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="[[~12]]"><i class="icon-user"></i> My Account</a></li> <li><a href="[[~12]]"><i class="icon-envelope"></i> Inbox <span class="badge badge-info"></span></a></li> <li class="divider"></li> <li><a href="?logout=1" title="Logout"><i class="icon-off"></i> Logout</a></li> </ul> </il> <?php else: ?> <li><a href="/register/">Sign up</a></li> <li><a href="/login/">Login</a></li> <?php endif; ?>
  4. thanks all for being so patient Could someone help me with the below, I am trying to show the name of the current logged in user. <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php $user->name; ?><b class="caret"></b></a>
  5. Not sure why and how, but I seem to have tried href="/" and now it works. Must not of uploaded changes. oops. Any documentation of syntax would really help me. As a non PHP coder, I struggle to understand when to use <?php , {, ", ', etc.... thank
  6. Hi All, I really seem to be struggling with the syntax of process wire, could anyone point me in the right directoin of some good documents or tutorials to read. I am trying to link back to my homepage / via the below and can't get it to work. <a class="navbar-brand" href="<?php echo $pages->get('/') ?>"><?php echo $pages->get("/site-settings/")->site_title; ?></a> What does everyone else use to go back to the root URL? thanks
  7. Hi all, just a quick question on best practice aka making life easier. I have created a template = home.php ( which contains my headers, footers, javacript, navbar) This is my base template. I have now followed a tutorial and created a login.php file and login template, but apart from the actual Login form and the login PHP the template is the same. Ideally I would like to just re-use the home template for this page and only add the custom HTML and custom PHP. How do others do this? <?php if($user->isLoggedin()) { // user is already logged in, so they don't need to be here $session->redirect("/"); } // check for login before outputting markup if($input->post->user && $input->post->pass) { $user = $sanitizer->username($input->post->user); $pass = $input->post->pass; if($session->login($user, $pass)) { // login successful $session->redirect("/"); } } ?> <!DOCTYPE html> <html lang="en"> <?php include("./head.inc"); ?> <?php include("./navbar.inc"); ?> <div class="container"> <div class="row"> <div class="container"> <div class="omb_login"> <h3 class="omb_authTitle">Login or <a href="#">Sign up</a></h3> <div class="row omb_row-sm-offset-3 omb_socialButtons"> <div class="col-xs-4 col-sm-2"> <a href="#" class="btn btn-lg btn-block omb_btn-facebook"> <i class="fa fa-facebook visible-xs"></i> <span class="hidden-xs">Facebook</span> </a> </div> <div class="col-xs-4 col-sm-2"> <a href="#" class="btn btn-lg btn-block omb_btn-twitter"> <i class="fa fa-twitter visible-xs"></i> <span class="hidden-xs">Twitter</span> </a> </div> <div class="col-xs-4 col-sm-2"> <a href="#" class="btn btn-lg btn-block omb_btn-google"> <i class="fa fa-google-plus visible-xs"></i> <span class="hidden-xs">Google+</span> </a> </div> </div> <div class="row omb_row-sm-offset-3 omb_loginOr"> <div class="col-xs-12 col-sm-6"> <hr class="omb_hrOr"> <span class="omb_spanOr">or</span> </div> </div> <div class="row omb_row-sm-offset-3"> <div class="col-xs-12 col-sm-6"> <form class="omb_loginForm" action="./" accept-charset="UTF-8" autocomplete="off" method="POST"> <div class="alert alert-error fade-in alert-dismissable"> <?php if($input->post->user) echo "<hf class='alert-heading'>Login failed</hf>"; ?> </div> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-user"></i></span> <input type="text" class="form-control" name="user" placeholder="Username"> </div> <span class="help-block"></span> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-lock"></i></span> <input type="password" class="form-control" name="pass" placeholder="Password"> </div> <span class="help-block"></span> <input class="returnUrl" type="hidden" name="returnUrl" value="[[+request_uri]]" /> <input class="loginLoginValue" type="hidden" name="service" value="login" /> <button class="btn btn-lg btn-primary btn-block" type="submit" name="submit" value="Login">Login</button> </form> </div> </div> <div class="row omb_row-sm-offset-3"> <div class="col-xs-12 col-sm-3"> <label class="checkbox"> <input type="checkbox" name="rememberme" value="1" checked="checked">Remember Me </label> </div> <div class="col-xs-12 col-sm-3"> <p class="omb_forgotPwd"> <a href="[[~5]]">Forgot password?</a> </p> </div> </div> </div> </div> <?php include ("./foot.inc"); ?> </div> <?php include ("./java.inc"); ?> </body> </html>
  8. thanks for the warm welcome all
  9. thanks for the info both, really excited to get stuck in. Sounds like a brilliant system!
  10. Hi All, I am feeling very lucky at present stabling across processwire, it seems very powerful and sounds like it would scale much better than MODx. I wanted to to just ask a few questions before I make the move from MODx, so if anyone wants to be so kind:) Having no real PHP experience, albeit I can quite happily use PHP operators such as ==, != , if, else etc.... Would it be easy enough for someone like me to create the following elements: Registration, Login, logout processes and use profiles Ability for users to create pages Add a voting/polling buttons (yes/no) to user created pages thanks so much for the help. Charles
×
×
  • Create New...