Difference between revisions of "Page Templates:Login Form"

From Whirlwind eCommerce Wiki
Jump to: navigation, search
Line 2: Line 2:
 
== Create log in template ==
 
== Create log in template ==
  
The log in template
+
Below is an example log-in template:
Below is an example shopping cart template:
+
  
 
<source lang="php">
 
<source lang="php">
Line 43: Line 42:
 
</source>
 
</source>
  
== Create shopping cart page ==
+
== Create log in page ==
; assign the new cart template to this page
+
; assign the new log-in template to this page
 
; check the 'hide this page from in-site searches'
 
; check the 'hide this page from in-site searches'
; post this page and take note of the page Id
 
 
== Set new page as shopping cart ==
 
; In settings > eCommerce tab: enter the pageId for the page just created into the "cart page id" field.
 
; post changes to settings
 

Revision as of 17:40, 8 February 2009

Page Template Managers

Create log in template

Below is an example log-in template:

// kick if logged in // recommended to place in 'pre process' code of template - no reason to waste processing power if we just gonna kick to home.
eV::authorizeIsLoggedOut('index.php?message=You cannot create an account while logged in');
 
// here is the global message
if(!empty($message)) echo "<p>" . $message . "</p>";
 
// the form
// note that the form CAN exist in the page copy of page management, it does not need to be hard encoded into the template
// most integrators will just create the above kick/message code and call it a "cannot be logged in" template, then use this template to control all pages that should only be seen if the visitor is not logged into a user account
echo "
<form name=\"loginForm\" target=\"index.php\" method=\"post\">
";
// email address, password and the hidden fa field are the only required fields for this form
// the fa field tells the system what to do when this form is submitted, in this case USER.login means attempt to login with the passed information
<br>Email Adddress:<input type=\"text\" size=30 maxlength=100 name=\"emailAddress\">
<br>Password:<input type=\"password\" size=20 maxlength=50 name=\"password\">
<input type=\"hidden\" name=\"fa\" value=\"USER.login\">
";
 
// the redirect field is optional. If used, this field tells the system where to send the user once the successfully login. We suggest the "you account" page.
// this field can also be dynamic, so visitors who log in during the checkout process are brought back into the checkout process, etc.
// if this field is not passed, the "default login success location" as set in Settings:Users, will be the destination page upon successful login
echo "<input type=\"hidden\" name=\"redirect\" value=\"index.php?pageId=555&message=You have logged in!\">";
 
// the redirectOnFailure field is optional. If used, this field tells the system where to send the user once the fail to login. We suggest sending them right back to this login page with a failure message. You may also develop a second login form page with a different title, subtitle, and copy and forward visitors to that page upon failure.
// if this field is not passed, the "default login failure location" as set in Settings:Users, will be the destination page upon failed login
// note that we are using the dynamic $pageId attribute here, therefore this part of the form must exist in the template copy and cannot exist in the page management copy. 
echo "<input type=\"hidden\" name=\"redirectOnFailure\" value=\"index.php?pageId=$pageId&message=Invalid login, please try again.\">";
 
// submit button
echo "<input type=\"submit\" value\"LOGIN!\">";
echo "
</form>
";

Create log in page

assign the new log-in template to this page
check the 'hide this page from in-site searches'