20150415--Front End Login + Product Details-02

Source: Internet
Author: User

third, the front desk member registration and login

View the design of members and administrator tables in Ecshop

Create a Membership table:

CREATE TABLE It_user (

ID smallint unsigned primary key auto_increment,

Username varchar (+) NOT NULL comment ' member's username ',

Password char (+) NOT NULL comment ' member's password ',

Email varchar (+) NOT NULL comment ' member's mailbox '

) engine MyISAM charset UTF8; 1, complete the registration function:

(1) Create a new user controller under the home module and inherit the index controller. and add the Register method, and copy the corresponding template page, modify the form according to the table structure.

(2) Create a new user model and add data validation,

(3) Complete the registration and login connection in the Header.html template page

2, complete the user's login

Create a new login method under the user controller and copy the corresponding template page.

Modify a signed-in form

The login function defined in the user model,

In the user controller, code:

In the header.html template page, depending on whether the login displays data,

3, save the user's information into the cookie, the next visit is directly logged in.

Iv. Complete the Product Details page

1. Add a goods method to the index controller to remove the product details. and copy the corresponding template page

Color is the name of the property: White is the value of the property

The name of the property in the It_attribute table, the value of the property in the It_goods_attr table

property sheet for the commodity:

It_goods_attr

attribute table for commodity types:

It_attribute;

Select A.attr_id,b.attr_type,b.attr_name,a.attr_value from It_goods_attr a left joins It_attribute B on A.attr_id=b.id whe Re a.goods_id=

2. The code in the goods method:

3, in the template page to traverse:

Five, complete a breadcrumb navigation

Idea: Find a family tree based on the cat_id of the product.

Open the category model and add a method to find the family tree

In the index controller below the home module, the index and category and the goods method call the function.

Traverse in the template page:

20150415--Front End Login + Product Details-02

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.