The method of realizing Alphabet Index search function in Dream Weaving dedecms
Dream weaving dedecms to achieve alphabet index search function? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!
DEDE system with "alphabetical index" function
The implementation method is as follows
The first step: first, we must modify the database structure and add the fields that store Pinyin.
Modify the dede_ Archives table to add pytitle,varchar (250). Null is allowed. The following is the SQL for creating the table, which is for reference only. The red part is the new part, which can be directly modified by phpmyadmin.
CREATE TABLE `dede_ archives` (`ID`int (11) unsigned NOT NULL auto_increment, `typeid` int (11) unsigned NOT NULL default '0stories, `typeid2` int (11) unsigned NOT NULL default' 0blocks, `sortrank` int (11) NOT NULL default '0questions, `iscommend` smallint (6) NOT NULL default' 0blocks, `ismake`smallint (6) NOT NULL default '0questions, `channel`int (11) NOT NULL default' 1levels, `arcrank` smallint (6) NOT NULL default '0blocks, `click` int (11) unsigned NOT NULL default' 0cycles, `money` smallint (6) NOT NULL default'0' `title` varchar (80) NOT NULL default ", `colortitle` varchar (36) NOT NULL default", `color` varchar (10) NOT NULL default ", `writer`varchar (30) NOT NULL default", `source`varchar (50) NOT NULL default ", `litpic` varchar (100) NOT NULL default", `pubdate`int (11) NOT NULL default '0mm, `senddate`int (11) NOT NULL default' 0mm, `arcatt` smallint (6) NOT NULL default '0mm, `adminID` int (11) NOT NULL default' 0mm, `memberID `int (11) unsigned NOT NULL default '0mm, `membertion` varchar (250) NOT NULL default " `keywords` varchar (60) NOT NULL default ", `templet` varchar (60) NOT NULL default", `lastpost` int (11) NOT NULL default '0mm, `postnum` int (11) NOT NULL default' 0mm, `redirecturl` varchar (150) NOT NULL default ", `mtype`int (11) NOT NULL default '0mm, `userip` varchar (20) NOT NULL default", `locklike id` smallint (6) NOT NULL default' 0mm, `likeid` varchar (240,240) default ", `pytitle`varchar (250,250) default NULL,PRIMARY KEY (`ID`), KEY `click` (`click`), KEY `senddate` (`sdateend`), KEY `typeid` (`typeid`) KEY `arcrank` (`arcrank`), KEY `sortrank` (`sortrank`), KEY `pubdate` (`pubdate`), KEY `litpic` (`litpic`), KEY `typeid2` (`typeid2`) ENGINE=MyISAM DEFAULT CHARSET=gbk
Step 2: get the pinyin initials of the article title and save it to the database.
The files that need to be modified are:
Article_add.php 、 article_add_action.php 、 article_edit.php 、 article_eidt_action.php
There are four files controlled by adding articles and modifying articles respectively.
Modify the article_add.php to:
Save Pinyin in bold
Add an option to save pinyin.
Modify the article_edit.php to: