1. Preface:
I personally never wrote a blog post, as a programmer does not own a blog as a qualified programmer, so I think also to run a blog, do a small project, write this blog count to do this project a project note it! Now self-taught thinkphp, this framework to do a CMS system. No more nonsense to say, hurriedly into the study.
2, Demand analysis:
Functional Analysis:
First, login Exit function.
Second, the menu function: related to the front-end menu navigation settings.
Three, the article management: The article writes, the editor plugin grasps, the asynchronous picture uploads.
Four, recommended bit management: Let the user set the homepage recommended article display settings.
V. User management: Manage user and Rights management of background login.
Basic management: That is, configuration management, to modify the operation of the site's head keyword, and set whether to generate cache and whether to automatically back up the database.
3. Table Design:
CREATE DATABASE ' tp_cms '; CREATE TABLE ' cms_admin ' (' admin_id ' mediumint (6) unsigned not NULL auto_increment, ' user_name ' varchar (a) NOT null Defaul T ' COMMENT ' admin id ', ' password ' varchar (+) NOT null default ' COMMENT ' password ', ' last_login_ip ' varchar (0 ') ' COMME ' NT ' Last login ip ', ' last_login_time ' int (ten) unsigned default ' 0 ' comment ' Last login time ', ' email ' varchar (+) Default ' comment ' email address ', ' Real_name ' varchar (+) NOT null default ' comment ' real name ', ' status ' tinyint (1) NOT null default ' 1 ' comment ' state ', primary K EY (' admin_id '), key ' user_name ' (' user_name ')) comment= ' Backstage user table ' Engine=myisam auto_increment=1 DEFAULT Charset=utf8; CREATE TABLE ' Cms_menu ' (' menu_id ' smallint (6) unsigned not null auto_increment comment ' menu id ', ' name ' varchar (+) NOT NULL Default ' comment ' menu name ', ' ParentID ' smallint (6) NOT null default ' 0 ' comment ' parent menu ', ' m ' varchar ' NOT null default ' ', ' C ' varchar () NOT NULL default ' ', ' f ' varchar (a) NOT null default ' ', ' listorder ' smallint (6) unsigned NOT NULL default ' 0 ' commeNT ' serial number ', ' status ' tinyint (1) unsigned NOT null default ' 1 ' comment ' state ', ' type ' tinyint (1) unsigned NOT null default ' 0 ' com ment ' type ', primary key (' menu_id '), key ' Listorder ' (' Listorder '), key ' ParentID ' (' ParentID '), key ' module ' (' m ', ' C ', ' F ')) Comment= ' Menu table ' Engine=myisam auto_increment=1 DEFAULT charset=utf8;create table ' cms_news ' (' news_id ' Mediumint (8) unsigned NOT NULL auto_increment comment ' news id ', ' catid ' smallint (5) unsigned NOT null default ' 0 ' comment ' column id ', ' title ' V Archar NOT NULL default ' caption ', ' small_title ' varchar (+) NOT null default ' small title ', ' title_font_color ' varchar (+) Default Null comment ' title color ', ' thumb ' varchar (+) NOT null default ' comment ' theme ', ' keywords ' char (+) NOT null default ' comment ' keyword ', ' description ' varchar (+) NOT NULL comment ' article description ', ' Listorder ' tinyint (3) unsigned NOT NULL default ' 0 ' comment ' ordinal ', ' status ' tinyint (1) NOT null default ' 1 ' comment ' state ', ' copyfrom ' varchar (+) default NULL comment ' article source ', ' user_name ' ch AR (+) not null comment ' user ', ' Create_time ' int (ten) unsigned NOT null default ' 0 ' comment ' creation time ', ' update_time ' int (ten) unsigned NOT null default ' 0 ' comment ' more New Time ', ' count ' int (ten) unsigned NOT NULL default ' total number of ' 0 ' comment ', primary key (' news_id '), key ' Listorder ' (' Listorder '), key ' CatID ' (' catid ')) comment= ' news article Main table ' Engine=myisam auto_increment=1 DEFAULT charset=utf8;create table ' cms_news_content ' (' ID ' mediumint (8) unsigned not NULL auto_increment comment ' id ', ' news_id ' mediumint (8) unsigned not NULL comment ' news id ', ' Content ' Mediumtext not null comment ' contents ', ' create_time ' int (ten) unsigned NOT null default ' 0 ' comment ' creation time ', ' update_time ' Int (ten) unsigned NOT null default ' 0 ' comment ' Update time ', primary key (' ID '), key ' news_id ' (' news_id ')) comment= ' news article content Sub-table ' ENGI Ne=myisam auto_increment=1 DEFAULT charset=utf8;create table ' cms_position ' (' ID ' smallint (5) unsigned NOT NULL auto_ Increment comment ' id ', ' name ' char (+) NOT null default ' comment ' name ', ' status ' tinyint (1) ' is not null default ' 1 ' comment ' Status ', ' description ' char (+) defaultNull comment ' description ', ' create_time ' int (ten) unsigned NOT null default ' 0 ' comment ' creation time ', ' update_time ' int (ten) unsigned not Nu ll default ' 0 ' comment ' Update time ', primary key (' ID ')) comment= ' Recommended bit management table ' Engine=myisam auto_increment=1 default Charset=utf8; CREATE TABLE ' cms_position_content ' (' ID ' smallint (5) unsigned not NULL auto_increment comment ' id ' comment ' id ', ' positon_ ID ' int (5) unsigned not NULL comment ' Recommended table id ', ' title ' varchar (+) NOT null default ' comment ' title ', ' thumb ' varchar (+) ' not ' Null default ' comment ' theme ', ' url ' varchar (+) default NULL comment ' address ', ' news_id ' mediumint (8) unsigned NOT NULL commen T ' news id ', ' listorder ' tinyint (3) unsigned NOT NULL default ' 0 ' comment ' sort id ', ' status ' tinyint (1) NOT null default ' 1 ' Comm Ent ' state ', ' create_time ' int (ten) unsigned NOT null default ' 0 ' comment ' creation time ', ' update_time ' int (ten) unsigned NOT null Defaul T ' 0 ' comment ' Update time ', primary key (' ID '), key ' positon_id ' (' positon_id ')) comment= ' Recommended bit content table ' Engine=myisam auto_increment=1 DEFAULT Charset=utf8;
Today, the first day to write here, already 22:33, do not stay up late to long pox, today, first design the table, tomorrow to encode!
Front-to-back thinkphp development Whole station (1)